Convert some more progmode menus to easy-menu-define

* lisp/progmodes/dcl-mode.el (dcl-mode-map):
* lisp/progmodes/icon.el (icon-mode-map):
* lisp/progmodes/scheme.el (scheme-mode-map):
Move menu definitions from here...
* lisp/progmodes/dcl-mode.el (dcl-mode-menu):
* lisp/progmodes/icon.el (icon-mode-menu)
* lisp/progmodes/scheme.el (scheme-mode-menu):
...to here, and use easy-menu-define.

* lisp/progmodes/icon.el
(icon-mode-map, icon-mode-syntax-table): Simplify.
This commit is contained in:
Stefan Kangas 2021-02-26 16:23:45 +01:00
parent 47f2a39f42
commit ffdb0a2d8e
3 changed files with 76 additions and 99 deletions

View file

@ -286,49 +286,30 @@ See `imenu-generic-expression' for details."
(define-key map "\C-c\C-o" 'dcl-set-option)
(define-key map "\C-c\C-f" 'tempo-forward-mark)
(define-key map "\C-c\C-b" 'tempo-backward-mark)
(define-key map [menu-bar] (make-sparse-keymap))
(define-key map [menu-bar dcl]
(cons "DCL" (make-sparse-keymap "DCL")))
;; Define these in bottom-up order
(define-key map [menu-bar dcl tempo-backward-mark]
'("Previous template mark" . tempo-backward-mark))
(define-key map [menu-bar dcl tempo-forward-mark]
'("Next template mark" . tempo-forward-mark))
(define-key map [menu-bar dcl tempo-complete-tag]
'("Complete template tag" . tempo-complete-tag))
(define-key map [menu-bar dcl dcl-separator-tempo]
'("--"))
(define-key map [menu-bar dcl dcl-save-all-options]
'("Save all options" . dcl-save-all-options))
(define-key map [menu-bar dcl dcl-save-nondefault-options]
'("Save changed options" . dcl-save-nondefault-options))
(define-key map [menu-bar dcl dcl-set-option]
'("Set option" . dcl-set-option))
(define-key map [menu-bar dcl dcl-separator-option]
'("--"))
(define-key map [menu-bar dcl dcl-delete-indentation]
'("Delete indentation" . dcl-delete-indentation))
(define-key map [menu-bar dcl dcl-split-line]
'("Split line" . dcl-split-line))
(define-key map [menu-bar dcl dcl-indent-command]
'("Indent command" . dcl-indent-command))
(define-key map [menu-bar dcl dcl-tab]
'("Indent line/insert tab" . dcl-tab))
(define-key map [menu-bar dcl dcl-back-to-indentation]
'("Back to indentation" . dcl-back-to-indentation))
(define-key map [menu-bar dcl dcl-forward-command]
'("End of statement" . dcl-forward-command))
(define-key map [menu-bar dcl dcl-backward-command]
'("Beginning of statement" . dcl-backward-command))
(define-key map [menu-bar dcl dcl-separator-movement]
'("--"))
(define-key map [menu-bar dcl imenu]
'("Buffer index menu" . imenu))
map)
"Keymap used in DCL-mode buffers.")
(easy-menu-define dcl-mode-menu dcl-mode-map
"Menu for DCL-mode buffers."
'("DCL"
["Buffer index menu" imenu]
"---"
["Beginning of statement" dcl-backward-command]
["End of statement" dcl-forward-command]
["Back to indentation" dcl-back-to-indentation]
["Indent line/insert tab" dcl-tab]
["Indent command" dcl-indent-command]
["Split line" dcl-split-line]
["Delete indentation" dcl-delete-indentation]
"---"
["Set option" dcl-set-option]
["Save changed options" dcl-save-nondefault-options]
["Save all options" dcl-save-all-options]
"---"
["Complete template tag" tempo-complete-tag]
["Next template mark" tempo-forward-mark]
["Previous template mark" tempo-backward-mark]))
(defcustom dcl-ws-r
"\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*"
"Regular expression describing white space in a DCL command line.

View file

@ -31,54 +31,49 @@
"Abbrev table in use in Icon-mode buffers.")
(define-abbrev-table 'icon-mode-abbrev-table ())
(defvar icon-mode-map ()
"Keymap used in Icon mode.")
(if icon-mode-map
()
(defvar icon-mode-map
(let ((map (make-sparse-keymap "Icon")))
(setq icon-mode-map (make-sparse-keymap))
(define-key icon-mode-map "{" 'electric-icon-brace)
(define-key icon-mode-map "}" 'electric-icon-brace)
(define-key icon-mode-map "\e\C-h" 'mark-icon-function)
(define-key icon-mode-map "\e\C-a" 'beginning-of-icon-defun)
(define-key icon-mode-map "\e\C-e" 'end-of-icon-defun)
(define-key icon-mode-map "\e\C-q" 'indent-icon-exp)
(define-key icon-mode-map "\177" 'backward-delete-char-untabify)
(define-key map "{" 'electric-icon-brace)
(define-key map "}" 'electric-icon-brace)
(define-key map "\e\C-h" 'mark-icon-function)
(define-key map "\e\C-a" 'beginning-of-icon-defun)
(define-key map "\e\C-e" 'end-of-icon-defun)
(define-key map "\e\C-q" 'indent-icon-exp)
(define-key map "\177" 'backward-delete-char-untabify)
map)
"Keymap used in Icon mode.")
(define-key icon-mode-map [menu-bar] (make-sparse-keymap "Icon"))
(define-key icon-mode-map [menu-bar icon]
(cons "Icon" map))
(define-key map [beginning-of-icon-defun] '("Beginning of function" . beginning-of-icon-defun))
(define-key map [end-of-icon-defun] '("End of function" . end-of-icon-defun))
(define-key map [comment-region] '("Comment Out Region" . comment-region))
(define-key map [indent-region] '("Indent Region" . indent-region))
(define-key map [indent-line] '("Indent Line" . icon-indent-command))
(put 'eval-region 'menu-enable 'mark-active)
(put 'comment-region 'menu-enable 'mark-active)
(put 'indent-region 'menu-enable 'mark-active)))
(easy-menu-define icon-mode-menu icon-mode-map
"Menu for Icon mode."
'("Icon"
["Beginning of function" beginning-of-icon-defun]
["Comment Out Region" comment-region
:enable mark-active]
["End of function" end-of-icon-defun]
["Indent Line" icon-indent-command]
["Indent Region" indent-region
:enable mark-active]))
(defvar icon-mode-syntax-table nil
(defvar icon-mode-syntax-table
(let ((table (make-syntax-table)))
(modify-syntax-entry ?\\ "\\" table)
(modify-syntax-entry ?# "<" table)
(modify-syntax-entry ?\n ">" 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)
table)
"Syntax table in use in Icon-mode buffers.")
(if icon-mode-syntax-table
()
(setq icon-mode-syntax-table (make-syntax-table))
(modify-syntax-entry ?\\ "\\" icon-mode-syntax-table)
(modify-syntax-entry ?# "<" icon-mode-syntax-table)
(modify-syntax-entry ?\n ">" icon-mode-syntax-table)
(modify-syntax-entry ?$ "." icon-mode-syntax-table)
(modify-syntax-entry ?/ "." icon-mode-syntax-table)
(modify-syntax-entry ?* "." icon-mode-syntax-table)
(modify-syntax-entry ?+ "." icon-mode-syntax-table)
(modify-syntax-entry ?- "." icon-mode-syntax-table)
(modify-syntax-entry ?= "." icon-mode-syntax-table)
(modify-syntax-entry ?% "." icon-mode-syntax-table)
(modify-syntax-entry ?< "." icon-mode-syntax-table)
(modify-syntax-entry ?> "." icon-mode-syntax-table)
(modify-syntax-entry ?& "." icon-mode-syntax-table)
(modify-syntax-entry ?| "." icon-mode-syntax-table)
(modify-syntax-entry ?\' "\"" icon-mode-syntax-table))
(defgroup icon nil
"Mode for editing Icon code."
:link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)

View file

@ -162,25 +162,26 @@
(defvar scheme-mode-line-process "")
(defvar scheme-mode-map
(let ((smap (make-sparse-keymap))
(map (make-sparse-keymap "Scheme")))
(set-keymap-parent smap lisp-mode-shared-map)
(define-key smap [menu-bar scheme] (cons "Scheme" map))
(define-key map [run-scheme] '("Run Inferior Scheme" . run-scheme))
(define-key map [uncomment-region]
'("Uncomment Out Region" . (lambda (beg end)
(interactive "r")
(comment-region beg end '(4)))))
(define-key map [comment-region] '("Comment Out Region" . comment-region))
(define-key map [indent-region] '("Indent Region" . indent-region))
(define-key map [indent-line] '("Indent Line" . lisp-indent-line))
(put 'comment-region 'menu-enable 'mark-active)
(put 'uncomment-region 'menu-enable 'mark-active)
(put 'indent-region 'menu-enable 'mark-active)
smap)
(let ((map (make-sparse-keymap)))
(set-keymap-parent map lisp-mode-shared-map)
map)
"Keymap for Scheme mode.
All commands in `lisp-mode-shared-map' are inherited by this map.")
(easy-menu-define scheme-mode-menu scheme-mode-map
"Menu for Scheme mode."
'("Scheme"
["Indent Line" lisp-indent-line]
["Indent Region" indent-region
:enable mark-active]
["Comment Out Region" comment-region
:enable mark-active]
["Uncomment Out Region" (lambda (beg end)
(interactive "r")
(comment-region beg end '(4)))
:enable mark-active]
["Run Inferior Scheme" run-scheme]))
;; Used by cmuscheme
(defun scheme-mode-commands (map)
;;(define-key map "\t" 'indent-for-tab-command) ; default