summaryrefslogtreecommitdiff
path: root/lisp/progmodes/elisp-mode.el
diff options
context:
space:
mode:
authorStefan Kangas <stefan@marxist.se>2021-02-27 15:15:29 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-02-27 15:24:35 +0100
commitcd411ecb28349f80d22488a2c2d0008eb6ad9a9e (patch)
treec425033a0f887d04fc4a57c832fb311751a9aac0 /lisp/progmodes/elisp-mode.el
parent36440b15d3552908614f0bd52f4defed8c1deed5 (diff)
downloademacs-cd411ecb28349f80d22488a2c2d0008eb6ad9a9e.tar.gz
Convert emacs-lisp-mode menu to easy-menu-define
* lisp/loadup.el: Preload easymenu. * lisp/progmodes/elisp-mode.el (emacs-lisp-mode-map): Convert menu to use easy-menu-define (bug#24774).
Diffstat (limited to 'lisp/progmodes/elisp-mode.el')
-rw-r--r--lisp/progmodes/elisp-mode.el215
1 files changed, 89 insertions, 126 deletions
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 37bed0c54e2..70aa66cdd0d 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -46,140 +46,103 @@ It has `lisp-mode-abbrev-table' as its parent."
"Syntax table used in `emacs-lisp-mode'.")
(defvar emacs-lisp-mode-map
- (let ((map (make-sparse-keymap))
- (menu-map (make-sparse-keymap "Emacs-Lisp"))
- (lint-map (make-sparse-keymap))
- (prof-map (make-sparse-keymap))
- (tracing-map (make-sparse-keymap)))
+ (let ((map (make-sparse-keymap)))
(set-keymap-parent map lisp-mode-shared-map)
(define-key map "\e\t" 'completion-at-point)
(define-key map "\e\C-x" 'eval-defun)
(define-key map "\e\C-q" 'indent-pp-sexp)
- (bindings--define-key map [menu-bar emacs-lisp]
- (cons "Emacs-Lisp" menu-map))
- (bindings--define-key menu-map [eldoc]
- '(menu-item "Auto-Display Documentation Strings" eldoc-mode
- :button (:toggle . (bound-and-true-p eldoc-mode))
- :help "Display the documentation string for the item under cursor"))
- (bindings--define-key menu-map [checkdoc]
- '(menu-item "Check Documentation Strings" checkdoc
- :help "Check documentation strings for style requirements"))
- (bindings--define-key menu-map [re-builder]
- '(menu-item "Construct Regexp" re-builder
- :help "Construct a regexp interactively"))
- (bindings--define-key menu-map [tracing] (cons "Tracing" tracing-map))
- (bindings--define-key tracing-map [tr-a]
- '(menu-item "Untrace All" untrace-all
- :help "Untrace all currently traced functions"))
- (bindings--define-key tracing-map [tr-uf]
- '(menu-item "Untrace Function..." untrace-function
- :help "Untrace function, and possibly activate all remaining advice"))
- (bindings--define-key tracing-map [tr-sep] menu-bar-separator)
- (bindings--define-key tracing-map [tr-q]
- '(menu-item "Trace Function Quietly..." trace-function-background
- :help "Trace the function with trace output going quietly to a buffer"))
- (bindings--define-key tracing-map [tr-f]
- '(menu-item "Trace Function..." trace-function
- :help "Trace the function given as an argument"))
- (bindings--define-key menu-map [profiling] (cons "Profiling" prof-map))
- (bindings--define-key prof-map [prof-restall]
- '(menu-item "Remove Instrumentation for All Functions" elp-restore-all
- :help "Restore the original definitions of all functions being profiled"))
- (bindings--define-key prof-map [prof-restfunc]
- '(menu-item "Remove Instrumentation for Function..." elp-restore-function
- :help "Restore an instrumented function to its original definition"))
-
- (bindings--define-key prof-map [sep-rem] menu-bar-separator)
- (bindings--define-key prof-map [prof-resall]
- '(menu-item "Reset Counters for All Functions" elp-reset-all
- :help "Reset the profiling information for all functions being profiled"))
- (bindings--define-key prof-map [prof-resfunc]
- '(menu-item "Reset Counters for Function..." elp-reset-function
- :help "Reset the profiling information for a function"))
- (bindings--define-key prof-map [prof-res]
- '(menu-item "Show Profiling Results" elp-results
- :help "Display current profiling results"))
- (bindings--define-key prof-map [prof-pack]
- '(menu-item "Instrument Package..." elp-instrument-package
- :help "Instrument for profiling all function that start with a prefix"))
- (bindings--define-key prof-map [prof-func]
- '(menu-item "Instrument Function..." elp-instrument-function
- :help "Instrument a function for profiling"))
- ;; Maybe this should be in a separate submenu from the ELP stuff?
- (bindings--define-key prof-map [sep-natprof] menu-bar-separator)
- (bindings--define-key prof-map [prof-natprof-stop]
- '(menu-item "Stop Native Profiler" profiler-stop
- :help "Stop recording profiling information"
- :enable (and (featurep 'profiler)
- (profiler-running-p))))
- (bindings--define-key prof-map [prof-natprof-report]
- '(menu-item "Show Profiler Report" profiler-report
- :help "Show the current profiler report"
- :enable (and (featurep 'profiler)
- (profiler-running-p))))
- (bindings--define-key prof-map [prof-natprof-start]
- '(menu-item "Start Native Profiler..." profiler-start
- :help "Start recording profiling information"))
-
- (bindings--define-key menu-map [lint] (cons "Linting" lint-map))
- (bindings--define-key lint-map [lint-di]
- '(menu-item "Lint Directory..." elint-directory
- :help "Lint a directory"))
- (bindings--define-key lint-map [lint-f]
- '(menu-item "Lint File..." elint-file
- :help "Lint a file"))
- (bindings--define-key lint-map [lint-b]
- '(menu-item "Lint Buffer" elint-current-buffer
- :help "Lint the current buffer"))
- (bindings--define-key lint-map [lint-d]
- '(menu-item "Lint Defun" elint-defun
- :help "Lint the function at point"))
- (bindings--define-key menu-map [edebug-defun]
- '(menu-item "Instrument Function for Debugging" edebug-defun
- :help "Evaluate the top level form point is in, stepping through with Edebug"
- :keys "C-u C-M-x"))
- (bindings--define-key menu-map [separator-byte] menu-bar-separator)
- (bindings--define-key menu-map [disas]
- '(menu-item "Disassemble Byte Compiled Object..." disassemble
- :help "Print disassembled code for OBJECT in a buffer"))
- (bindings--define-key menu-map [byte-recompile]
- '(menu-item "Byte-recompile Directory..." byte-recompile-directory
- :help "Recompile every `.el' file in DIRECTORY that needs recompilation"))
- (bindings--define-key menu-map [emacs-byte-compile-and-load]
- '(menu-item "Byte-compile and Load" emacs-lisp-byte-compile-and-load
- :help "Byte-compile the current file (if it has changed), then load compiled code"))
- (bindings--define-key menu-map [byte-compile]
- '(menu-item "Byte-compile This File" emacs-lisp-byte-compile
- :help "Byte compile the file containing the current buffer"))
- (bindings--define-key menu-map [separator-eval] menu-bar-separator)
- (bindings--define-key menu-map [ielm]
- '(menu-item "Interactive Expression Evaluation" ielm
- :help "Interactively evaluate Emacs Lisp expressions"))
- (bindings--define-key menu-map [eval-buffer]
- '(menu-item "Evaluate Buffer" eval-buffer
- :help "Execute the current buffer as Lisp code"))
- (bindings--define-key menu-map [eval-region]
- '(menu-item "Evaluate Region" eval-region
- :help "Execute the region as Lisp code"
- :enable mark-active))
- (bindings--define-key menu-map [eval-sexp]
- '(menu-item "Evaluate Last S-expression" eval-last-sexp
- :help "Evaluate sexp before point; print value in echo area"))
- (bindings--define-key menu-map [separator-format] menu-bar-separator)
- (bindings--define-key menu-map [comment-region]
- '(menu-item "Comment Out Region" comment-region
- :help "Comment or uncomment each line in the region"
- :enable mark-active))
- (bindings--define-key menu-map [indent-region]
- '(menu-item "Indent Region" indent-region
- :help "Indent each nonblank line in the region"
- :enable mark-active))
- (bindings--define-key menu-map [indent-line]
- '(menu-item "Indent Line" lisp-indent-line))
map)
"Keymap for Emacs Lisp mode.
All commands in `lisp-mode-shared-map' are inherited by this map.")
+(easy-menu-define emacs-lisp-mode-menu emacs-lisp-mode-map
+ "Menu for Emacs Lisp mode."
+ '("Emacs-Lisp"
+ ["Indent Line" lisp-indent-line]
+ ["Indent Region" indent-region
+ :help "Indent each nonblank line in the region"
+ :active mark-active]
+ ["Comment Out Region" comment-region
+ :help "Comment or uncomment each line in the region"
+ :active mark-active]
+ "---"
+ ["Evaluate Last S-expression" eval-last-sexp
+ :help "Evaluate sexp before point; print value in echo area"]
+ ["Evaluate Region" eval-region
+ :help "Execute the region as Lisp code"
+ :active mark-active]
+ ["Evaluate Buffer" eval-buffer
+ :help "Execute the current buffer as Lisp code"]
+ ["Interactive Expression Evaluation" ielm
+ :help "Interactively evaluate Emacs Lisp expressions"]
+ "---"
+ ["Byte-compile This File" emacs-lisp-byte-compile
+ :help "Byte compile the file containing the current buffer"]
+ ["Byte-compile and Load" emacs-lisp-byte-compile-and-load
+ :help "Byte-compile the current file (if it has changed), then load compiled code"]
+ ["Byte-recompile Directory..." byte-recompile-directory
+ :help "Recompile every `.el' file in DIRECTORY that needs recompilation"]
+ ["Disassemble Byte Compiled Object..." disassemble
+ :help "Print disassembled code for OBJECT in a buffer"]
+ "---"
+ ["Instrument Function for Debugging" edebug-defun
+ :help "Evaluate the top level form point is in, stepping through with Edebug"
+ :keys "C-u C-M-x"]
+ ["Linting"
+ ["Lint Defun" elint-defun
+ :help "Lint the function at point"]
+ ["Lint Buffer" elint-current-buffer
+ :help "Lint the current buffer"]
+ ["Lint File..." elint-file
+ :help "Lint a file"]
+ ["Lint Directory..." elint-directory
+ :help "Lint a directory"]]
+ ["Profiling"
+ ;; Maybe this should be in a separate submenu from the ELP stuff?
+ ["Start Native Profiler..." profiler-start
+ :help "Start recording profiling information"]
+ ["Show Profiler Report" profiler-report
+ :help "Show the current profiler report"
+ :active (and (featurep 'profiler)
+ (profiler-running-p))]
+ ["Stop Native Profiler" profiler-stop
+ :help "Stop recording profiling information"
+ :active (and (featurep 'profiler)
+ (profiler-running-p))]
+ "---"
+ ["Instrument Function..." elp-instrument-function
+ :help "Instrument a function for profiling"]
+ ["Instrument Package..." elp-instrument-package
+ :help "Instrument for profiling all function that start with a prefix"]
+ ["Show Profiling Results" elp-results
+ :help "Display current profiling results"]
+ ["Reset Counters for Function..." elp-reset-function
+ :help "Reset the profiling information for a function"]
+ ["Reset Counters for All Functions" elp-reset-all
+ :help "Reset the profiling information for all functions being profiled"]
+ "---"
+ ["Remove Instrumentation for All Functions" elp-restore-all
+ :help "Restore the original definitions of all functions being profiled"]
+ ["Remove Instrumentation for Function..." elp-restore-function
+ :help "Restore an instrumented function to its original definition"]]
+ ["Tracing"
+ ["Trace Function..." trace-function
+ :help "Trace the function given as an argument"]
+ ["Trace Function Quietly..." trace-function-background
+ :help "Trace the function with trace output going quietly to a buffer"]
+ "---"
+ ["Untrace All" untrace-all
+ :help "Untrace all currently traced functions"]
+ ["Untrace Function..." untrace-function
+ :help "Untrace function, and possibly activate all remaining advice"]]
+ ["Construct Regexp" re-builder
+ :help "Construct a regexp interactively"]
+ ["Check Documentation Strings" checkdoc
+ :help "Check documentation strings for style requirements"]
+ ["Auto-Display Documentation Strings" eldoc-mode
+ :button (:toggle . (bound-and-true-p eldoc-mode))
+ :help "Display the documentation string for the item under cursor"]))
+
(defun emacs-lisp-byte-compile ()
"Byte compile the file containing the current buffer."
(interactive nil emacs-lisp-mode)