aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Kangas2021-02-26 16:23:45 +0100
committerStefan Kangas2021-02-26 16:51:19 +0100
commitffdb0a2d8e64980d63b7c1c6c71ac6e2d26b4fb2 (patch)
treed481fdfd4f55ff585c0411f8b6db10b118b1c104
parent47f2a39f427f2e7bfd3de371316e3a2c47841340 (diff)
downloademacs-ffdb0a2d8e64980d63b7c1c6c71ac6e2d26b4fb2.tar.gz
emacs-ffdb0a2d8e64980d63b7c1c6c71ac6e2d26b4fb2.zip
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.
-rw-r--r--lisp/progmodes/dcl-mode.el61
-rw-r--r--lisp/progmodes/icon.el85
-rw-r--r--lisp/progmodes/scheme.el33
3 files changed, 78 insertions, 101 deletions
diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el
index 4a8a20a2969..6ffceb444c1 100644
--- a/lisp/progmodes/dcl-mode.el
+++ b/lisp/progmodes/dcl-mode.el
@@ -286,49 +286,30 @@ See `imenu-generic-expression' for details."
286 (define-key map "\C-c\C-o" 'dcl-set-option) 286 (define-key map "\C-c\C-o" 'dcl-set-option)
287 (define-key map "\C-c\C-f" 'tempo-forward-mark) 287 (define-key map "\C-c\C-f" 'tempo-forward-mark)
288 (define-key map "\C-c\C-b" 'tempo-backward-mark) 288 (define-key map "\C-c\C-b" 'tempo-backward-mark)
289
290 (define-key map [menu-bar] (make-sparse-keymap))
291 (define-key map [menu-bar dcl]
292 (cons "DCL" (make-sparse-keymap "DCL")))
293
294 ;; Define these in bottom-up order
295 (define-key map [menu-bar dcl tempo-backward-mark]
296 '("Previous template mark" . tempo-backward-mark))
297 (define-key map [menu-bar dcl tempo-forward-mark]
298 '("Next template mark" . tempo-forward-mark))
299 (define-key map [menu-bar dcl tempo-complete-tag]
300 '("Complete template tag" . tempo-complete-tag))
301 (define-key map [menu-bar dcl dcl-separator-tempo]
302 '("--"))
303 (define-key map [menu-bar dcl dcl-save-all-options]
304 '("Save all options" . dcl-save-all-options))
305 (define-key map [menu-bar dcl dcl-save-nondefault-options]
306 '("Save changed options" . dcl-save-nondefault-options))
307 (define-key map [menu-bar dcl dcl-set-option]
308 '("Set option" . dcl-set-option))
309 (define-key map [menu-bar dcl dcl-separator-option]
310 '("--"))
311 (define-key map [menu-bar dcl dcl-delete-indentation]
312 '("Delete indentation" . dcl-delete-indentation))
313 (define-key map [menu-bar dcl dcl-split-line]
314 '("Split line" . dcl-split-line))
315 (define-key map [menu-bar dcl dcl-indent-command]
316 '("Indent command" . dcl-indent-command))
317 (define-key map [menu-bar dcl dcl-tab]
318 '("Indent line/insert tab" . dcl-tab))
319 (define-key map [menu-bar dcl dcl-back-to-indentation]
320 '("Back to indentation" . dcl-back-to-indentation))
321 (define-key map [menu-bar dcl dcl-forward-command]
322 '("End of statement" . dcl-forward-command))
323 (define-key map [menu-bar dcl dcl-backward-command]
324 '("Beginning of statement" . dcl-backward-command))
325 (define-key map [menu-bar dcl dcl-separator-movement]
326 '("--"))
327 (define-key map [menu-bar dcl imenu]
328 '("Buffer index menu" . imenu))
329 map) 289 map)
330 "Keymap used in DCL-mode buffers.") 290 "Keymap used in DCL-mode buffers.")
331 291
292(easy-menu-define dcl-mode-menu dcl-mode-map
293 "Menu for DCL-mode buffers."
294 '("DCL"
295 ["Buffer index menu" imenu]
296 "---"
297 ["Beginning of statement" dcl-backward-command]
298 ["End of statement" dcl-forward-command]
299 ["Back to indentation" dcl-back-to-indentation]
300 ["Indent line/insert tab" dcl-tab]
301 ["Indent command" dcl-indent-command]
302 ["Split line" dcl-split-line]
303 ["Delete indentation" dcl-delete-indentation]
304 "---"
305 ["Set option" dcl-set-option]
306 ["Save changed options" dcl-save-nondefault-options]
307 ["Save all options" dcl-save-all-options]
308 "---"
309 ["Complete template tag" tempo-complete-tag]
310 ["Next template mark" tempo-forward-mark]
311 ["Previous template mark" tempo-backward-mark]))
312
332(defcustom dcl-ws-r 313(defcustom dcl-ws-r
333 "\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*" 314 "\\([ \t]*-[ \t]*\\(!.*\\)*\n\\)*[ \t]*"
334 "Regular expression describing white space in a DCL command line. 315 "Regular expression describing white space in a DCL command line.
diff --git a/lisp/progmodes/icon.el b/lisp/progmodes/icon.el
index a36f020439d..d81fe1c753b 100644
--- a/lisp/progmodes/icon.el
+++ b/lisp/progmodes/icon.el
@@ -31,53 +31,48 @@
31 "Abbrev table in use in Icon-mode buffers.") 31 "Abbrev table in use in Icon-mode buffers.")
32(define-abbrev-table 'icon-mode-abbrev-table ()) 32(define-abbrev-table 'icon-mode-abbrev-table ())
33 33
34(defvar icon-mode-map () 34(defvar icon-mode-map
35 "Keymap used in Icon mode.")
36(if icon-mode-map
37 ()
38 (let ((map (make-sparse-keymap "Icon"))) 35 (let ((map (make-sparse-keymap "Icon")))
39 (setq icon-mode-map (make-sparse-keymap)) 36 (define-key map "{" 'electric-icon-brace)
40 (define-key icon-mode-map "{" 'electric-icon-brace) 37 (define-key map "}" 'electric-icon-brace)
41 (define-key icon-mode-map "}" 'electric-icon-brace) 38 (define-key map "\e\C-h" 'mark-icon-function)
42 (define-key icon-mode-map "\e\C-h" 'mark-icon-function) 39 (define-key map "\e\C-a" 'beginning-of-icon-defun)
43 (define-key icon-mode-map "\e\C-a" 'beginning-of-icon-defun) 40 (define-key map "\e\C-e" 'end-of-icon-defun)
44 (define-key icon-mode-map "\e\C-e" 'end-of-icon-defun) 41 (define-key map "\e\C-q" 'indent-icon-exp)
45 (define-key icon-mode-map "\e\C-q" 'indent-icon-exp) 42 (define-key map "\177" 'backward-delete-char-untabify)
46 (define-key icon-mode-map "\177" 'backward-delete-char-untabify) 43 map)
47 44 "Keymap used in Icon mode.")
48 (define-key icon-mode-map [menu-bar] (make-sparse-keymap "Icon"))
49 (define-key icon-mode-map [menu-bar icon]
50 (cons "Icon" map))
51 (define-key map [beginning-of-icon-defun] '("Beginning of function" . beginning-of-icon-defun))
52 (define-key map [end-of-icon-defun] '("End of function" . end-of-icon-defun))
53 (define-key map [comment-region] '("Comment Out Region" . comment-region))
54 (define-key map [indent-region] '("Indent Region" . indent-region))
55 (define-key map [indent-line] '("Indent Line" . icon-indent-command))
56 (put 'eval-region 'menu-enable 'mark-active)
57 (put 'comment-region 'menu-enable 'mark-active)
58 (put 'indent-region 'menu-enable 'mark-active)))
59
60(defvar icon-mode-syntax-table nil
61 "Syntax table in use in Icon-mode buffers.")
62 45
63(if icon-mode-syntax-table 46(easy-menu-define icon-mode-menu icon-mode-map
64 () 47 "Menu for Icon mode."
65 (setq icon-mode-syntax-table (make-syntax-table)) 48 '("Icon"
66 (modify-syntax-entry ?\\ "\\" icon-mode-syntax-table) 49 ["Beginning of function" beginning-of-icon-defun]
67 (modify-syntax-entry ?# "<" icon-mode-syntax-table) 50 ["Comment Out Region" comment-region
68 (modify-syntax-entry ?\n ">" icon-mode-syntax-table) 51 :enable mark-active]
69 (modify-syntax-entry ?$ "." icon-mode-syntax-table) 52 ["End of function" end-of-icon-defun]
70 (modify-syntax-entry ?/ "." icon-mode-syntax-table) 53 ["Indent Line" icon-indent-command]
71 (modify-syntax-entry ?* "." icon-mode-syntax-table) 54 ["Indent Region" indent-region
72 (modify-syntax-entry ?+ "." icon-mode-syntax-table) 55 :enable mark-active]))
73 (modify-syntax-entry ?- "." icon-mode-syntax-table) 56
74 (modify-syntax-entry ?= "." icon-mode-syntax-table) 57(defvar icon-mode-syntax-table
75 (modify-syntax-entry ?% "." icon-mode-syntax-table) 58 (let ((table (make-syntax-table)))
76 (modify-syntax-entry ?< "." icon-mode-syntax-table) 59 (modify-syntax-entry ?\\ "\\" table)
77 (modify-syntax-entry ?> "." icon-mode-syntax-table) 60 (modify-syntax-entry ?# "<" table)
78 (modify-syntax-entry ?& "." icon-mode-syntax-table) 61 (modify-syntax-entry ?\n ">" table)
79 (modify-syntax-entry ?| "." icon-mode-syntax-table) 62 (modify-syntax-entry ?$ "." table)
80 (modify-syntax-entry ?\' "\"" icon-mode-syntax-table)) 63 (modify-syntax-entry ?/ "." table)
64 (modify-syntax-entry ?* "." table)
65 (modify-syntax-entry ?+ "." table)
66 (modify-syntax-entry ?- "." table)
67 (modify-syntax-entry ?= "." table)
68 (modify-syntax-entry ?% "." table)
69 (modify-syntax-entry ?< "." table)
70 (modify-syntax-entry ?> "." table)
71 (modify-syntax-entry ?& "." table)
72 (modify-syntax-entry ?| "." table)
73 (modify-syntax-entry ?\' "\"" table)
74 table)
75 "Syntax table in use in Icon-mode buffers.")
81 76
82(defgroup icon nil 77(defgroup icon nil
83 "Mode for editing Icon code." 78 "Mode for editing Icon code."
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index a899de7e594..72ac2d95a21 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -162,25 +162,26 @@
162(defvar scheme-mode-line-process "") 162(defvar scheme-mode-line-process "")
163 163
164(defvar scheme-mode-map 164(defvar scheme-mode-map
165 (let ((smap (make-sparse-keymap)) 165 (let ((map (make-sparse-keymap)))
166 (map (make-sparse-keymap "Scheme"))) 166 (set-keymap-parent map lisp-mode-shared-map)
167 (set-keymap-parent smap lisp-mode-shared-map) 167 map)
168 (define-key smap [menu-bar scheme] (cons "Scheme" map))
169 (define-key map [run-scheme] '("Run Inferior Scheme" . run-scheme))
170 (define-key map [uncomment-region]
171 '("Uncomment Out Region" . (lambda (beg end)
172 (interactive "r")
173 (comment-region beg end '(4)))))
174 (define-key map [comment-region] '("Comment Out Region" . comment-region))
175 (define-key map [indent-region] '("Indent Region" . indent-region))
176 (define-key map [indent-line] '("Indent Line" . lisp-indent-line))
177 (put 'comment-region 'menu-enable 'mark-active)
178 (put 'uncomment-region 'menu-enable 'mark-active)
179 (put 'indent-region 'menu-enable 'mark-active)
180 smap)
181 "Keymap for Scheme mode. 168 "Keymap for Scheme mode.
182All commands in `lisp-mode-shared-map' are inherited by this map.") 169All commands in `lisp-mode-shared-map' are inherited by this map.")
183 170
171(easy-menu-define scheme-mode-menu scheme-mode-map
172 "Menu for Scheme mode."
173 '("Scheme"
174 ["Indent Line" lisp-indent-line]
175 ["Indent Region" indent-region
176 :enable mark-active]
177 ["Comment Out Region" comment-region
178 :enable mark-active]
179 ["Uncomment Out Region" (lambda (beg end)
180 (interactive "r")
181 (comment-region beg end '(4)))
182 :enable mark-active]
183 ["Run Inferior Scheme" run-scheme]))
184
184;; Used by cmuscheme 185;; Used by cmuscheme
185(defun scheme-mode-commands (map) 186(defun scheme-mode-commands (map)
186 ;;(define-key map "\t" 'indent-for-tab-command) ; default 187 ;;(define-key map "\t" 'indent-for-tab-command) ; default