Adjust occur-context-menu and elisp-context-menu

* lisp/progmodes/elisp-mode.el (elisp-context-menu): Add separator
only when there is a symbol at mouse click.

* lisp/replace.el (occur-context-menu): Insert items in the middle
of the menu after mark-whole-buffer.
This commit is contained in:
Juri Linkov 2021-09-15 10:20:42 +03:00
parent 3eb80b7847
commit ba28acf3b8
2 changed files with 10 additions and 7 deletions

View file

@ -154,9 +154,9 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
: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 [elisp-separator] menu-bar-separator
'mark-whole-buffer)
(define-key-after menu [describe-symbol]
'(menu-item "Describe Symbol"
(lambda (click) (interactive "e")