summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1995-07-17 22:47:19 +0000
committerKarl Heuer <kwzh@gnu.org>1995-07-17 22:47:19 +0000
commit87f031bfde5e4d3c60042be0f45a2d52266eaba5 (patch)
tree9c9acf2d5c9a045015279b8066918fcfac3d036a /lisp/mouse.el
parent1719fb4f59490dc2c921ddb24028a4569365c624 (diff)
downloademacs-87f031bfde5e4d3c60042be0f45a2d52266eaba5.tar.gz
(mouse-major-mode-menu): Catch quit in read-key-sequence.
(mouse-major-mode-menu): Don't call command-execute if lookup-key gives nil.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el20
1 files changed, 13 insertions, 7 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 84daf4b4a91..a52d0d14213 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -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)