[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 8c80430: * lisp/progmodes/elisp-mode.el (elisp-context-menu): New
From: |
Juri Linkov |
Subject: |
master 8c80430: * lisp/progmodes/elisp-mode.el (elisp-context-menu): New function (bug#9054) |
Date: |
Mon, 13 Sep 2021 14:41:44 -0400 (EDT) |
branch: master
commit 8c80430824d52e5dfae97db2669b419621817956
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/progmodes/elisp-mode.el (elisp-context-menu): New function (bug#9054)
(emacs-lisp-mode): Add elisp-context-menu to context-menu-functions.
---
lisp/progmodes/elisp-mode.el | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 8befae0..e5ad36c 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -153,6 +153,26 @@ All commands in `lisp-mode-shared-map' are inherited by
this map.")
:style toggle
:selected (bound-and-true-p eldoc-mode)]))
+(defun elisp-context-menu (menu click)
+ (define-key-after menu [elisp-separator] menu-bar-separator
+ 'mark-whole-buffer)
+ (when (thing-at-mouse click 'symbol)
+ (define-key-after menu [describe-symbol]
+ '(menu-item "Describe Symbol"
+ (lambda (click) (interactive "e")
+ (describe-symbol
+ (intern (thing-at-mouse click 'symbol t))))
+ :help "Display the full documentation of symbol")
+ 'elisp-separator)
+ (define-key-after menu [info-lookup-symbol]
+ '(menu-item "Lookup Symbol"
+ (lambda (click) (interactive "e")
+ (info-lookup-symbol
+ (intern (thing-at-mouse click 'symbol t))))
+ :help "Display definition in relevant manual")
+ 'describe-symbol))
+ menu)
+
(defun emacs-lisp-byte-compile ()
"Byte compile the file containing the current buffer."
(interactive nil emacs-lisp-mode)
@@ -280,7 +300,8 @@ Blank lines separate paragraphs. Semicolons start comments.
#'elisp-completion-at-point nil 'local)
(add-hook 'flymake-diagnostic-functions #'elisp-flymake-checkdoc nil t)
(add-hook 'flymake-diagnostic-functions
- #'elisp-flymake-byte-compile nil t))
+ #'elisp-flymake-byte-compile nil t)
+ (add-hook 'context-menu-functions #'elisp-context-menu 10 t))
;; Font-locking support.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 8c80430: * lisp/progmodes/elisp-mode.el (elisp-context-menu): New function (bug#9054),
Juri Linkov <=