aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love1999-07-19 21:49:13 +0000
committerDave Love1999-07-19 21:49:13 +0000
commitb98e5762e699bc0684714ad62c16d6e2dab85e30 (patch)
tree24381a0298aa54bc0b21d5c938ed9e081eecdb77
parentfb8ba9078c5d76a6c9ccf79678886fb1aba7816c (diff)
downloademacs-b98e5762e699bc0684714ad62c16d6e2dab85e30.tar.gz
emacs-b98e5762e699bc0684714ad62c16d6e2dab85e30.zip
(mouse-major-mode-menu): Default to menu-bar-edit-menu
for modes which don't define menus.
-rw-r--r--lisp/mouse.el34
1 files changed, 20 insertions, 14 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 47ede180693..e011e23f8ee 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -45,25 +45,31 @@
45;; Provide a mode-specific menu on a mouse button. 45;; Provide a mode-specific menu on a mouse button.
46 46
47(defun mouse-major-mode-menu (event prefix) 47(defun mouse-major-mode-menu (event prefix)
48 "Pop up a mode-specific menu of mouse commands." 48 "Pop up a mode-specific menu of mouse commands.
49Default to the Edit menu if the major mode doesn't define a menu."
49 ;; Switch to the window clicked on, because otherwise 50 ;; Switch to the window clicked on, because otherwise
50 ;; the mode's commands may not make sense. 51 ;; the mode's commands may not make sense.
51 (interactive "@e\nP") 52 (interactive "@e\nP")
52 ;; Let the mode update its menus first. 53 ;; Let the mode update its menus first.
53 (run-hooks 'activate-menubar-hook) 54 (run-hooks 'activate-menubar-hook)
54 (let (;; This is where mouse-major-mode-menu-prefix 55 (let* (;; This is where mouse-major-mode-menu-prefix
55 ;; returns the prefix we should use (after menu-bar). 56 ;; returns the prefix we should use (after menu-bar).
56 ;; It is either nil or (SOME-SYMBOL). 57 ;; It is either nil or (SOME-SYMBOL).
57 (mouse-major-mode-menu-prefix nil) 58 (mouse-major-mode-menu-prefix nil)
58 ;; Make a keymap in which our last command leads to a menu 59 ;; Keymap from which to inherit; may be null.
59 (newmap (make-sparse-keymap (concat mode-name " Mode"))) 60 (ancestor (mouse-major-mode-menu-1
60 result) 61 (and (current-local-map)
61 ;; Make our menu inherit from the desired keymap 62 (lookup-key (current-local-map) [menu-bar]))))
62 ;; which we want to display as the menu now. 63 ;; Make a keymap in which our last command leads to a menu or
63 (set-keymap-parent newmap 64 ;; default to the edit menu.
64 (mouse-major-mode-menu-1 65 (newmap (if ancestor
65 (and (current-local-map) 66 (make-sparse-keymap (concat mode-name " Mode"))
66 (lookup-key (current-local-map) [menu-bar])))) 67 menu-bar-edit-menu))
68 result)
69 (if ancestor
70 ;; Make our menu inherit from the desired keymap which we want
71 ;; to display as the menu now.
72 (set-keymap-parent newmap ancestor))
67 (setq result (x-popup-menu t (list newmap))) 73 (setq result (x-popup-menu t (list newmap)))
68 (if result 74 (if result
69 (let ((command (key-binding 75 (let ((command (key-binding