;; MuPAD editing support package ;; ;; Major mode for MuPAD editing. It provides functions for editing ;; MuPAD code and interacting with MuPAD and Mint. See the documentation ;; of mupad-mode. ;; ;; LCD Archive Entry: ;; mupad-mode|Winfried Trümper|winni@xpilot.org| ;; MuPAD editing support| ;; 27-Mar-98|1.3|~/modes/mupad.el.Z| ;; ;; Maintainer: Winfried Trümper ;; ;; This code was initialy stolen by me from "maple.el" which is the work ;; of Bruno Salvy (Bruno.Salvy@inria.fr). The changes I (Winfried) ;; initialy did did are: ;; ;; sed -e "s/Maple/MuPAD/g" -e "s/maple/mupad/g" maple.el > mupad.el ;; ;; and regarding to the MuPAD-Syntax: ;; ;; read '... ' -> read("...") ;; od -> end_while, end_for ;; fi -> end_if ;; ;; all further changes were done with the help of MuPAD users and are ;; listed below. ;; ;; modified 15/09/1995: First relaes of mupad.el ;; modified 22/09/1995: Paul Zimmermann ;; suggested: ;; - mupad-comment should write two comments signs ;; - mupad-procedure is missing ;; - the mupad-title and mupad-modify commands should ;; take care about comments (one # at the beginning ;; and one at the end) ;; modified 27/03/1998: Olivier Ramare ;; added a comfortable entry to the menu bar, made ;; "mupad-local" and "mupad-else" more friendly ;; and improved the installation ;; The following variable decides where "help" is to be found. (defvar mupad-lib-directory "/usr/local/MuPAD/share/lib") (provide 'mupad) (defvar mupad-mode-syntax-table nil "Syntax table in use in mupad-mode buffers.") (if mupad-mode-syntax-table () (let ((table (make-syntax-table))) (modify-syntax-entry ?\\ "\\ " table) (modify-syntax-entry ?\n "> " table) (modify-syntax-entry ?\f "> " table) (modify-syntax-entry ?# "< " table) (modify-syntax-entry ?\t " " table) (modify-syntax-entry ?* ". " table) (modify-syntax-entry ?+ ". " table) (modify-syntax-entry ?- ". " table) (modify-syntax-entry ?/ ". " table) (modify-syntax-entry ?= ". " table) (modify-syntax-entry ?< ". " table) (modify-syntax-entry ?> ". " table) (modify-syntax-entry ?\' "\" " table) (modify-syntax-entry ?\` "\" " table) (modify-syntax-entry ?\" ". " table) (modify-syntax-entry ?\{ "(} " table) (modify-syntax-entry ?\[ "(] " table) (modify-syntax-entry ?\( "() " table) (modify-syntax-entry ?\} "){ " table) (modify-syntax-entry ?\] ")[ " table) (modify-syntax-entry ?\) ")( " table) (setq mupad-mode-syntax-table table))) (defvar mupad-mode-map nil "Keymap used in MuPAD mode.") (if mupad-mode-map () (let ((map (make-sparse-keymap))) (define-key map "\C-m" 'mupad-newline) (define-key map "\C-?" 'mupad-untab) (define-key map "\C-i" 'mupad-tab) (define-key map "\C-c<" 'mupad-backward-to-same-indent) (define-key map "\C-c>" 'mupad-forward-to-same-indent) (define-key map "\C-c#" 'mupad-inline-comment) (define-key map "\C-ce" 'mupad-else) (define-key map "\C-cf" 'mupad-for) (define-key map "\C-ch" 'mupad-help) (define-key map "\C-ci" 'mupad-if) (define-key map "\C-cl" 'mupad-local) (define-key map "\C-cm" 'mupad-modify) (define-key map "\C-cp" 'mupad-proc) (define-key map "\C-ct" 'mupad-title) (define-key map "\C-cw" 'mupad-while) (define-key map "\C-c\C-i" 'mupad-make-library) (define-key map "\C-c\C-r" 'mupad-region) (define-key map "\C-c\C-b" 'mupad-buffer) (define-key map "\C-c\C-m" 'mint-buffer) (define-key map "\C-c\C-z" 'suspend-emacs) (define-key map "\C-c(" 'mupad-paired-parens) (setq mupad-mode-map map))) (defvar mupad-indent 4 "*This variable gives the indentation in MuPAD-Mode") ;;;;;Compiler pacifier (defvar comment-column 41 "A comment should start after this column") (defvar end-comment-column 72 "If the current column is larger than this value, then the comment starts on a new line") ;;;;;End of Compiler pacifier (defun mupad-mode () "This is a mode intended to support program development in MuPAD. All control constructs of MuPAD can be reached by typing Control-C followed by the first character of the construct. Use \\[mupad-region] to run MuPAD on the current region under a special subshell. \\[mupad-buffer] does the whole buffer, \\[mupad-make-library] doeis it with mupad -s option. \\[mint-buffer] runs mint on the buffer. Control-c f for Control-c e else Control-c i if Control-c l local Control-c w while Control-c p proc Control-c # comment Control-c h help Control-c m modify Control-c t title Control-c ( paired parens Control-c Control-z suspend-emacs C-c < and C-c > move backward and forward respectively to the next line having the same (or lesser) level of indentation. mupad-indent controls the number of spaces for each indentation. Note that in a MuPAD subshell buffer, C-p and C-n are bound to mupad-previous-command and mupad-next-commmand, while M-p and M-n are bound to previous-line and next-line. Use C-cT to toggle this behavior. \\{mupad-mode-map} " (interactive) (kill-all-local-variables) (mupad-define-common-keys mupad-mode-map) (use-local-map mupad-mode-map) (setq major-mode 'mupad-mode) (setq mode-name "MuPAD") (make-local-variable 'comment-column) (setq comment-column 41) (make-local-variable 'end-comment-column) (setq end-comment-column 72) (set-syntax-table mupad-mode-syntax-table) (make-local-variable 'paragraph-start) (setq paragraph-start (concat "^$\\|" page-delimiter)) (make-local-variable 'paragraph-separate) (setq paragraph-separate paragraph-start) (make-local-variable 'paragraph-ignore-fill-prefix) (setq paragraph-ignore-fill-prefix t) ;; (make-local-variable 'indent-line-function) ;; (setq indent-line-function 'c-indent-line) (make-local-variable 'require-final-newline) (setq require-final-newline t) (make-local-variable 'comment-start) (setq comment-start "#") (make-local-variable 'comment-end) (setq comment-end "\n") (make-local-variable 'comment-column) (setq comment-column 41) (make-local-variable 'comment-start-skip) (setq comment-start-skip "#+ *") ; Le compilateur d'emacs dit de remplacer : comment-indent-hook ; par : comment-indent-function ; dans : (make-local-variable 'comment-indent-hook) (make-local-variable 'comment-indent-function) ; (setq comment-indent-hook 'c-comment-indent) (setq comment-indent-function 'c-comment-indent) (make-local-variable 'parse-sexp-ignore-comments) (setq parse-sexp-ignore-comments nil) (run-hooks 'mupad-mode-hook)) (defun mupad-newline () "Insert a newline and indent following line like previous line." (interactive) (let ((hpos (current-indentation))) (newline) (indent-to hpos))) (defun mupad-tab () "Indent to next tab stop." (interactive) (if (> (current-column) (current-indentation)) (insert "\t") (back-to-indentation) (let ((ci (current-indentation))) (backward-delete-char-untabify ci) (indent-to (* (1+ (/ ci mupad-indent)) mupad-indent))))) (defun mupad-tabsize (s) "changes spacing used for indentation. Reads spacing from minibuffer." (interactive "nNew indentation spacing: ") (setq mupad-indent s)) (defun mupad-untab () "Delete backwards to previous tab stop." (interactive) (backward-delete-char-untabify (let ((ind (current-indentation))) (if (and (= ind (current-column)) (>= ind mupad-indent)) mupad-indent 1)))) (defun mupad-go-to-this-indent (step indent-level) "Move point repeatedly by lines till the current line has given indent-level or less, or the start/end of the buffer is hit. Ignore blank lines and comments." (while (and (zerop (forward-line step)) (or (looking-at "^[ ]*$") (looking-at "^[ ]*#") (looking-at "^<<[A-Za-z0-9_]+>>") (looking-at "^[A-Za-z0-9_]+:") (> (current-indentation) indent-level))) nil)) (defun mupad-backward-to-same-indent () "Move point backwards to nearest line with same indentation or less. If not found, point is left at top of buffer." (interactive) (mupad-go-to-this-indent -1 (current-indentation)) (back-to-indentation)) (defun mupad-forward-to-same-indent () "Move point forwards to nearest line with same indentation or less. If not found, point is left at start of last line in buffer." (interactive) (mupad-go-to-this-indent 1 (current-indentation)) (back-to-indentation)) (defun mupad-for () "Build skeleton for-loop statment, prompting for the loop parameters." (interactive) (let ((for (read-string "var: "))) (if (string-equal for "") (let ((to (read-string "to: "))) (if (not (string-equal to "")) (insert " to " to))) (insert "for " for) (let ((in (read-string "in: "))) (if (not (string-equal in "")) (insert " in " in) (let ((from (read-string "from: "))) (if (not (string-equal from "")) (insert " from " from))) ;; (let ((by (read-string "by: "))) ;; (if (not (string-equal by "")) ;; (insert " by " by))) (let ((to (read-string "to: "))) (if (not (string-equal to "")) (insert " to " to))))))) ;; (let ((while (read-string "while: "))) ;; (if (not (string-equal while "")) ;; (insert " while " while))) (insert " do") (mupad-newline) (mupad-newline) (insert "end_for;") (end-of-line 0) (mupad-tab)) (defun mupad-while () "Build skeleton while-loop statment, prompting for the loop parameters." (interactive) (insert "while " (read-string "conditional: ")) (insert " do") (mupad-newline) (mupad-newline) (insert "end_while;") (end-of-line 0) (mupad-tab)) (defun mupad-title () "Insert a comment block containing the module title, author, etc." (interactive) (if (eq (point) (point-min)) nil (set-mark (point)) (goto-line 1)) (insert "\n\n") (previous-line 2) (insert "# -*-MuPAD-*-\n") (insert "##\n## Title: \t") (insert (read-string "Title: ")) (insert "\n## Created:\t") (insert (current-time-string)) (insert "\n## Author: \t") (insert (user-full-name)) (insert (concat "\n##\t\t<" (user-login-name) "@" (system-name) ">\n")) (insert "##\n## Description: ") (insert "\n#\n") (end-of-line nil)) (defun mupad-modify () "Insert a comment block containing the modification, author, etc." (interactive) (set-mark (point)) (goto-line 1) (while (char-equal (char-after (point)) 35) (forward-line 1)) (insert "#\n## Modified: \t") (insert (current-time-string)) (insert "\n## Author: \t") (insert (user-full-name)) (insert "\n## Modification: ") (insert (read-string "Modification: ")) (insert "\n#\n")) (defun mupad-if () "Insert skeleton if statment, prompting for ." (interactive) (insert "if " (read-string "conditional: ") " then") (mupad-newline) (mupad-newline) (insert "end_if;") (end-of-line 0) (mupad-tab)) (defun mupad-else () "Add an elif clause to an if statement, prompting for the condition. When no condition is given, put an else." (interactive) (if (save-excursion (beginning-of-line) (looking-at " *$")) (mupad-untab)) (let ((condition (read-string "elif: "))) (if (string-equal condition "") (insert "else") (insert "elif " condition " then"))) (mupad-newline) (mupad-tab)) (defun mupad-local () "Add a new local variable, inserting the word local if necessary." (interactive) (save-excursion (set-mark (point)) (while (or (and (> (current-indentation) 0) (not (looking-at " *local"))) (looking-at " *#") (looking-at " *end") (looking-at " *option")) (forward-line -1)) (let ((first-time)) (if (looking-at " *local") (setq first-time nil) (forward-line 1) (insert "local ;\n") (forward-line -1) (setq first-time t)) (search-forward ";") (backward-char) (let ((newvar (read-string "New variable: "))) (if first-time (insert newvar) (insert ", " newvar)))))) (defun mupad-proc () (interactive) (let ((name (read-string "Name: " )) args) (insert name ":=proc (") (insert (read-string "Arguments: ") ")") (let ((options (read-string "Options: "))) (if (not (string-equal options "")) (progn (mupad-newline) (insert "options " options ";")))) (mupad-newline) (mupad-newline) (insert "end_proc: #") (insert name) (insert " #") (end-of-line 0) (mupad-tab))) (defun mupad-paired-parens () "Insert a pair of round parentheses, placing point between them." (interactive) (insert "()") (backward-char)) (defun mupad-inline-comment () "Start a comment after the end of the line, indented at least COMMENT-COLUMN. If starting after END-COMMENT-COLUMN, start a new line." (interactive) (end-of-line) (if (> (current-column) end-comment-column) (newline)) (if (< (current-column) comment-column) (indent-to comment-column)) (insert "# #") (backward-char) (backward-char)) (defun mupad-display-comment () "Inserts 3 comment lines, making a display comment." (interactive) (save-excursion (insert "#\n## \n#") (end-of-line 0)) (forward-char 5)) (defun mupad-help () "Like describe-function in lisp-mode, tries to guess which function is interesting for the user and prompts for confirmation, then displays help. This could be much better if we called MuPAD to find the file, but I do not see how it could be as fast. This will only work with version 5 or higher." (interactive) (save-excursion (let ((orig (point)) eow bow) (forward-word -1) (setq bow (point)) (forward-word 1) (setq eow (point)) (let* ((posfuncname (buffer-substring bow eow)) (funcname (read-string (if (string-equal posfuncname "") "Help about: " (concat "Help about [" posfuncname "]: ")))) filename) (and (string-equal funcname "") (setq funcname posfuncname)) (if (string-match "[a-zA-Z]*\\[" funcname) (setq filename (concat mupad-lib-directory "/help/" (substring funcname 0 (- (match-end 0) 1)) "/text/" (substring funcname (match-end 0) (- (length funcname) 1)) ".m")) (setq filename (concat mupad-lib-directory "/../doc/ascii/" funcname ".help"))) (or (file-exists-p filename) (error "Cannot find help for this function")) (with-output-to-temp-buffer "*MuPAD Help*" ; fonction obsolete (buffer-flush-undo standard-output) (buffer-disable-undo standard-output) (save-excursion (set-buffer standard-output) (insert-file-contents filename) (goto-char (point-min)) (kill-line 4) (replace-regexp "\230\226\214" "\n") (goto-char (point-min)) (replace-regexp "[^\n -~]" ""))))))) ;;; Invoking MuPAD in an inferior shell. (defvar mupad-command "mupad" "The command to run mupad on a file.") (defvar mupad-args "-S" "Arguments passed to mupad. For old versions of MuPAD, -q could be useful") (defvar mupad-prompt-regexp "^[^-> \n]*>+ +" "\ *Regexp defining the prompt in MuPAD sessions.") (defvar mint-command "mint" "The command to run mint on a file. The name of the file will be appended to this string, separated by <.") (defvar mint-level "2" "Sets the verbosity of Mint") (defun mupad-define-common-keys (keymap) "Define the keys that we want defined both in mupad-mode and in the mupad-shell." (define-key keymap "\C-c\C-k" 'mupad-kill-job) (define-key keymap "\C-c\C-l" 'mupad-recenter-output-buffer) (define-key keymap "\C-ch" 'mupad-help)) (defvar mupad-shell-map nil "Keymap for the mupad shell. A shell-mode-map with a few additions") (defvar mupad-temp-directory "/tmp/" "*Directory in which to create temporary files.") (defvar zap-file nil "Temporary file name used for text being sent as input to MuPAD.") (defun mupad () "Run mupad in a buffer, without shell. Exiting mupad will kill the buffer. The buffer is called *MuPAD*, and the program used comes from variable mupad-command (default mupad). The buffer is put in shell-mode with a mupad-syntax-table." (interactive) (if (get-buffer "*MuPAD*") nil (mupad-start-shell "*MuPAD*")) (switch-to-buffer "*MuPAD*")) (defun mupad-start-shell (name) (require 'shell) (save-excursion (set-process-sentinel (if (not (string-equal mupad-args "")) (start-process "mupad" name (concat "env") "TERM=emacs" ; so that the process may know it ; is called by emacs "PAGER=cat" ; because of 4.3 help ; "PAGER=emacsclient" ; because of 4.3 help ;; "-" mupad-command mupad-args) (start-process "mupad" name (concat "env") "TERM=emacs" ; so that the process may know it ; is called by emacs "PAGER=cat" ; because of 4.3 help ; "PAGER=emacsclient" ; because of 4.3 help ;; "-" mupad-command)) 'mupad-process-sentinel) (set-buffer name) (shell-mode) (make-local-variable 'shell-prompt-pattern) (setq shell-prompt-pattern mupad-prompt-regexp) (set-syntax-table mupad-mode-syntax-table) (setq mupad-shell-map (copy-keymap shell-mode-map)) (mupad-define-common-keys mupad-shell-map) (define-key mupad-shell-map "\M-p" 'previous-line) (define-key mupad-shell-map "\M-n" 'next-line) (define-key mupad-shell-map "\C-p" 'mupad-previous-command) (define-key mupad-shell-map "\C-n" 'mupad-next-command) (define-key mupad-shell-map "\C-cT" 'mupad-toggle-previous-next-behavior) (use-local-map mupad-shell-map))) (defun mupad-process-sentinel (proc mesg) (let ((stat (process-status proc)) (name (process-buffer proc))) (cond ((eq stat 'run) nil) ((eq stat 'stop) (continue-process proc) (if (and (not (eq (process-status proc) 'run)) name (save-excursion (kill-buffer name))))) (t (if (not name) nil (save-excursion (kill-buffer name))))))) (defun mupad-region (beg end) "Run MuPAD on the current region. A temporary file (zap-file) is written in directory mupad-temp-directory, but MuPAD is run in the current directory." (interactive "r") (let ((name (concat "*" (buffer-name) "-MuPAD*"))) (or (get-buffer name) (mupad-start-shell name)) (if zap-file (if (file-exists-p zap-file) (delete-file zap-file)) (setq zap-file (expand-file-name (concat mupad-temp-directory (make-temp-name "#mz"))))) (save-excursion (save-restriction (widen) (goto-char (point-min)) (write-region beg end zap-file t nil)) (send-string (get-buffer-process name) (concat "read\(\"" zap-file "\"\);\n"))) (sit-for 1) (mupad-recenter-output-buffer nil))) (defun mint-shell (name) (require 'shell) (save-excursion (set-process-sentinel (start-process "mint" "*Mint*" mint-command "-i" mint-level name) 'mint-process-sentinel) (set-buffer "*Mint*") (shell-mode))) (defun mint-process-sentinel (proc mesg) (let ((stat (process-status proc)) (name (process-buffer proc))) (cond ((eq stat 'run) nil) ((eq stat 'stop) (continue-process proc)) (t nil)))) (defun mint-region (beg end) "Run Mint on the current region. A temporary file (zap-file) is written in directory mupad-temp-directory, but Mint is run in the current directory." (interactive "r") (let ((name "*Mint*")) (if (get-buffer name) (save-excursion (kill-buffer name))) (if zap-file (if (file-exists-p zap-file) (delete-file zap-file)) (setq zap-file (expand-file-name (concat mupad-temp-directory (make-temp-name "#mz"))))) (save-excursion (save-restriction (widen) (goto-char (point-min)) (write-region beg end zap-file t nil)) (mint-shell zap-file)) (pop-to-buffer "*Mint*"))) (defun mupad-buffer () "Run MuPAD on current buffer. See \\[mupad-region] for more information." (interactive) (mupad-region (point-min) (point-max))) (defun mupad-make-library () "Run MuPAD on current buffer, with option -s." (interactive) (let ((mupad-args "-s")) (mupad-region (point-min) (point-max)))) (defun mint-buffer () "Run Mint on current buffer. See \\[mint-region] for more information." (interactive) (mint-region (point-min) (point-max))) (defun mupad-kill-job () "Kill the currently running MuPAD job." (interactive) (if (get-buffer-process (current-buffer)) (kill-buffer (current-buffer)) (let ((name (concat "*" (buffer-name) "-MuPAD*"))) (and (get-buffer name) (kill-buffer name))))) (defun mupad-recenter-output-buffer (linenum) "Redisplay buffer of MuPAD job output so that most recent output can be seen. The last line of the buffer is displayed on line LINE of the window, or centered if LINE is nil." (interactive "P") (let ((old-buffer (current-buffer)) (mupad-shell(if (get-buffer-process (current-buffer)) (current-buffer) (or (get-buffer (concat "*" (buffer-name) "-MuPAD*")) (get-buffer "*MuPAD*"))))) (if (null mupad-shell) (message "No MuPAD output buffer") (pop-to-buffer mupad-shell) (goto-char (point-max)) (recenter (if linenum (prefix-numeric-value linenum) (/(window-height) 2))) (pop-to-buffer old-buffer)))) (defun mupad-previous-command () "Recall previous mupad command." (interactive) (mupad-relative-command -1)) (defun mupad-next-command () "Step to mupad next command line." (interactive) (mupad-relative-command 1)) (defun mupad-relative-command (dir) "Step to previous or next command line according to the first argument being 1 or -1." (while (and (zerop (forward-line dir)) (not (looking-at mupad-prompt-regexp)) (looking-at "^"))); forward-line at the end of a buffer (end-of-line)) (defun mupad-toggle-previous-next-behavior () "Change C-p/M-p C-n/M-n from previous-line and next-line to mupad-previous-command and mupad-next-command and reciprocally" (interactive) (if (equal (key-binding "\C-p") 'previous-line) (progn (define-key mupad-shell-map "\M-p" 'previous-line) (define-key mupad-shell-map "\M-n" 'next-line) (define-key mupad-shell-map "\C-p" 'mupad-previous-command) (define-key mupad-shell-map "\C-n" 'mupad-next-command)) (define-key mupad-shell-map "\C-p" 'previous-line) (define-key mupad-shell-map "\C-n" 'next-line) (define-key mupad-shell-map "\M-p" 'mupad-previous-command) (define-key mupad-shell-map "\M-n" 'mupad-next-command))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; To install some colors. ;; "face"'s names like "define" "defun" "warning" etc ;; are taken from "hilit19.el", and defined there with ;; the constant "hilit-default-face-table". (if (featurep 'hilit19) (hilit-set-mode-patterns 'mupad-mode '(("export(" ")" define) ("loadlib(" ")" define) ("\#" "#" comment) ))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Add a menu to the menu-bar (and NOT to the usual menubar). (if (featurep 'menu-bar) (progn (defvar menu-bar-mupad-menu (make-sparse-keymap "MuPAD") "Keymap used for the menu-bar's item MuPAD") (define-key global-map [menu-bar mupad-menu] (cons "MuPAD" menu-bar-mupad-menu)) ;; We now define the submenu "Shortcuts" (defvar menu-bar-shortcuts-mupad-menu (make-sparse-keymap "Shortcuts") "Keymap used for the submenu-bar's item Shortcuts of menu MuPAD") (fset 'menu-bar-shortcuts-mupad-menu (symbol-value 'menu-bar-shortcuts-mupad-menu)) (define-key menu-bar-shortcuts-mupad-menu [recenter-output-buffer-mupad] '("Recenter Ouput Buffer" . mupad-recenter-output-buffer)) (put 'recenter-output-buffer-mupad 'menu-enable 'mark-active) (define-key menu-bar-shortcuts-mupad-menu [paired-paren-mupad] '("Paired \(\)" . mupad-paired-parens)) (put 'paired-parens-mupad 'menu-enable 'mark-active) ;; The next command is so natural, we don't mention it ;; (define-key menu-bar-shortcuts-mupad-menu [newline-mupad] ;; '("Newline" . mupad-newline)) ;; (put 'newline-mupad 'menu-enable 'mark-active) (define-key menu-bar-shortcuts-mupad-menu [tabsize-mupad] '("Redefine Tab Size" . mupad-tabsize)) (put 'tabsize-mupad 'menu-enable 'mark-active) (define-key menu-bar-shortcuts-mupad-menu [untab-mupad] '("Untab" . mupad-untab)) (put 'untab-mupad 'menu-enable 'mark-active) (define-key menu-bar-shortcuts-mupad-menu [tab-mupad] '("Tab" . mupad-tab)) (put 'tab-mupad 'menu-enable 'mark-active) (define-key menu-bar-shortcuts-mupad-menu [backward-mupad] '("Backward to same indent" . mupad-backward-to-same-indent)) (put 'backward-mupad 'menu-enable 'mark-active) (define-key menu-bar-shortcuts-mupad-menu [forward-mupad] '("Forward to same indent" . mupad-forward-to-same-indent)) (put 'forward-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [shortcuts-mupad] '("Shortcuts" . menu-bar-shortcuts-mupad-menu)) (put 'shortcuts-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [help-mupad] '("Help" . mupad-help)) (put 'help-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [separator-help-mupad] '("--")) (define-key menu-bar-mupad-menu [modify-mupad] '("Modify" . mupad-modify)) (put 'modify-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [display-comment-mupad] '("Display Comments" . mupad-display-comment)) (put 'display-comment-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [comment-mupad] '("Comment" . mupad-inline-comment)) (put 'comment-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [separator-comment-mupad] '("--")) (define-key menu-bar-mupad-menu [for-mupad] '("For" . mupad-for)) (put 'for-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [while-mupad] '("While" . mupad-while)) (put 'while-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [else-mupad] '("Else/Elif" . mupad-else)) (put 'else-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [if-mupad] '("If" . mupad-if)) (put 'if-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [title-mupad] '("Title" . mupad-title)) (put 'title-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [local-mupad] '("Local" . mupad-local)) (put 'local-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [proc-mupad] '("Procedure" . mupad-proc)) (put 'proc-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [separator-proc-mupad] '("--")) (define-key menu-bar-mupad-menu [kill-mupad] '("Kill the MuPAD session" . mupad-kill-job)) (put 'kill-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [library-mupad] '("Run MuPAD -s in region" . mupad-make-library)) (put 'library-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [region-mupad] '("Run MuPAD in region" . mupad-region)) (put 'region-mupad 'menu-enable 'mark-active) ;; Couldn't understand the following function. Residu of Maple ? ;; (define-key menu-bar-mupad-menu [mint-mupad] ;; '("?????" . mint-buffer)) ;; (put 'mint-mupad 'menu-enable 'mark-active) (define-key menu-bar-mupad-menu [run-mupad] '("Run MuPAD" . mupad-buffer)) (put 'run-mupad 'menu-enable 'mark-active) ))