(global-set-key "\C-cm" 'public-math) (setq auto-mode-alist (append '( ("\\.m$" . math-mode) ) auto-mode-alist)) (cond (window-system (require 'hilit19) (hilit-set-mode-patterns 'math-mode '(("(\\*" "\\*)" comment) (hilit-string-find ?\\ string) )))) (defun math-mode () (interactive) (setq major-mode 'math-mode mode-name "Math") (setq math-local-map (make-keymap)) (define-key math-local-map "\C-cc" 'public-math-comment) (define-key math-local-map [f5] 'public-math-file) (use-local-map math-local-map) ) (defun public-math-comment () (interactive) (insert "(**)") ) (defun public-math-file() (interactive) (save-buffer) (let ((file (buffer-file-name))) (switch-to-buffer-other-window (make-comint "Mathematica" "math")) (goto-char (point-max)) (insert (concat "<<" file)) (comint-send-input) )) (defun public-math () (interactive) (require 'comint) (switch-to-buffer-other-window (make-comint "Mathematica" "math")) (goto-char (point-max)) (comint-send-input) )