[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 0ac58e8 2/2: * lisp/progmodes/elisp-mode.el (elisp-context-menu):
From: |
Juri Linkov |
Subject: |
master 0ac58e8 2/2: * lisp/progmodes/elisp-mode.el (elisp-context-menu): Improve menu items. |
Date: |
Fri, 17 Sep 2021 12:03:17 -0400 (EDT) |
branch: master
commit 0ac58e89d71024177b791dc9c3d16a0f82d62aac
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/progmodes/elisp-mode.el (elisp-context-menu): Improve menu items.
---
lisp/progmodes/elisp-mode.el | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index d40ae47..0431198 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -159,19 +159,26 @@ All commands in `lisp-mode-shared-map' are inherited by
this map.")
(define-key-after menu [elisp-separator] menu-bar-separator
'middle-separator)
(define-key-after menu [info-lookup-symbol]
- '(menu-item "Look up Symbol"
+ '(menu-item "Look up in Manual"
(lambda (click) (interactive "e")
(info-lookup-symbol
(intern (thing-at-mouse click 'symbol t))))
:help "Display definition in relevant manual")
'elisp-separator)
- (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))
+ (let* ((string (thing-at-mouse click 'symbol t))
+ (symbol (when (stringp string) (intern string)))
+ (title (cond
+ ((not (symbolp symbol)) nil)
+ ((fboundp symbol) "Function")
+ ((and (boundp symbol) (not (keywordp symbol))) "Variable")
+ ((facep symbol) "Face"))))
+ (when title
+ (define-key-after menu [describe-symbol]
+ `(menu-item (format "Describe %s" ,title)
+ (lambda (_click) (interactive "e")
+ (describe-symbol ',symbol))
+ :help "Display the full documentation of symbol")
+ 'elisp-separator))))
menu)
(defun emacs-lisp-byte-compile ()