mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-22 07:09:54 +00:00
(mouse-major-mode-menu): Catch quit in read-key-sequence.
(mouse-major-mode-menu): Don't call command-execute if lookup-key gives nil.
This commit is contained in:
parent
37c29340c7
commit
e26815c37e
@ -55,13 +55,19 @@
|
||||
(and (current-local-map)
|
||||
(lookup-key (current-local-map) [menu-bar])))))
|
||||
(mouse-major-mode-menu-compute-equiv-keys newmap)
|
||||
(command-execute
|
||||
;; Make NEWMAP override the usual definition
|
||||
;; of the mouse button that got us here.
|
||||
;; Then read the user's menu choice.
|
||||
(let ((minor-mode-map-alist
|
||||
(cons (cons t newmap) minor-mode-map-alist)))
|
||||
(lookup-key newmap (read-key-sequence ""))))))
|
||||
;; Make NEWMAP override the usual definition
|
||||
;; of the mouse button that got us here.
|
||||
;; Then read the user's menu choice.
|
||||
(let* ((minor-mode-map-alist
|
||||
(cons (cons t newmap) minor-mode-map-alist))
|
||||
;; read-key-sequence quits if the user aborts the menu.
|
||||
;; If that happens, do nothing silently.
|
||||
(keyseq (condition-case nil
|
||||
(read-key-sequence "")
|
||||
(quit nil)))
|
||||
(command (if keyseq (lookup-key newmap keyseq))))
|
||||
(if command
|
||||
(command-execute command)))))
|
||||
|
||||
;; Compute and cache the equivalent keys in MENU and all its submenus.
|
||||
(defun mouse-major-mode-menu-compute-equiv-keys (menu)
|
||||
|
Loading…
Reference in New Issue
Block a user