Commit 25db2767 authored by Dave Love's avatar Dave Love
Browse files

(mouse-major-mode-menu): Use local-key-binding.

(mouse-popup-menubar): Add minor mode menus.
(popup-menu): Check for lookup-key returning number.
parent 2713a63d
...@@ -76,6 +76,8 @@ PREFIX is the prefix argument (if any) to pass to the command." ...@@ -76,6 +76,8 @@ PREFIX is the prefix argument (if any) to pass to the command."
binding) binding)
(while (and map (null binding)) (while (and map (null binding))
(setq binding (lookup-key (car map) mouse-click)) (setq binding (lookup-key (car map) mouse-click))
(if (numberp binding) ; `too long'
(setq binding nil))
(setq map (cdr map))) (setq map (cdr map)))
binding) binding)
;; We were given a single keymap. ;; We were given a single keymap.
...@@ -111,7 +113,7 @@ Default to the Edit menu if the major mode doesn't define a menu." ...@@ -111,7 +113,7 @@ Default to the Edit menu if the major mode doesn't define a menu."
;; Keymap from which to inherit; may be null. ;; Keymap from which to inherit; may be null.
(ancestor (mouse-major-mode-menu-1 (ancestor (mouse-major-mode-menu-1
(and (current-local-map) (and (current-local-map)
(lookup-key (current-local-map) [menu-bar])))) (local-key-binding [menu-bar]))))
;; Make a keymap in which our last command leads to a menu or ;; Make a keymap in which our last command leads to a menu or
;; default to the edit menu. ;; default to the edit menu.
(newmap (if ancestor (newmap (if ancestor
...@@ -169,6 +171,7 @@ not it is actually displayed." ...@@ -169,6 +171,7 @@ not it is actually displayed."
(lookup-key (current-local-map) [menu-bar]))) (lookup-key (current-local-map) [menu-bar])))
(global-menu (lookup-key global-map [menu-bar])) (global-menu (lookup-key global-map [menu-bar]))
(local-title-or-map (and local-menu (cadr local-menu))) (local-title-or-map (and local-menu (cadr local-menu)))
(minor-mode-menus (mapcar #'cdr (minor-mode-key-binding [menu-bar])))
(global-title-or-map (cadr global-menu))) (global-title-or-map (cadr global-menu)))
;; If the keymaps don't have prompt string (a lazy programmer ;; If the keymaps don't have prompt string (a lazy programmer
;; didn't bother to provide one), create it and insert it into the ;; didn't bother to provide one), create it and insert it into the
...@@ -184,9 +187,10 @@ not it is actually displayed." ...@@ -184,9 +187,10 @@ not it is actually displayed."
(cons "Global Menu" (cons "Global Menu"
(cdr global-menu))))) (cdr global-menu)))))
;; Supplying the list is faster than making a new map. ;; Supplying the list is faster than making a new map.
(popup-menu (if local-menu (popup-menu (append (list global-menu)
(list global-menu local-menu) (if local-menu
(list global-menu)) (list local-menu))
minor-mode-menus)
event prefix))) event prefix)))
(defun mouse-popup-menubar-stuff (event prefix) (defun mouse-popup-menubar-stuff (event prefix)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment