From: Karl Heuer Date: Mon, 17 Jul 1995 22:47:19 +0000 (+0000) Subject: (mouse-major-mode-menu): Catch quit in read-key-sequence. X-Git-Tag: emacs-19.34~3306 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e26815c37e16b15af699bd186c1271081c46346c;p=emacs.git (mouse-major-mode-menu): Catch quit in read-key-sequence. (mouse-major-mode-menu): Don't call command-execute if lookup-key gives nil. --- 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)