diff options
| author | Dave Love | 2000-08-29 11:10:48 +0000 |
|---|---|---|
| committer | Dave Love | 2000-08-29 11:10:48 +0000 |
| commit | 25db2767face977e16ef580bd72a8226445f9b92 (patch) | |
| tree | 2e1d092b4ef329a5fa03f31a7725a9e0461fb19d | |
| parent | 2713a63d159eb4ccf865925514c2c459239041ce (diff) | |
| download | emacs-25db2767face977e16ef580bd72a8226445f9b92.tar.gz emacs-25db2767face977e16ef580bd72a8226445f9b92.zip | |
(mouse-major-mode-menu): Use local-key-binding.
(mouse-popup-menubar): Add minor mode menus.
(popup-menu): Check for lookup-key returning number.
| -rw-r--r-- | lisp/mouse.el | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 019ea21e52e..8cc878d2f90 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -76,6 +76,8 @@ PREFIX is the prefix argument (if any) to pass to the command." | |||
| 76 | binding) | 76 | binding) |
| 77 | (while (and map (null binding)) | 77 | (while (and map (null binding)) |
| 78 | (setq binding (lookup-key (car map) mouse-click)) | 78 | (setq binding (lookup-key (car map) mouse-click)) |
| 79 | (if (numberp binding) ; `too long' | ||
| 80 | (setq binding nil)) | ||
| 79 | (setq map (cdr map))) | 81 | (setq map (cdr map))) |
| 80 | binding) | 82 | binding) |
| 81 | ;; We were given a single keymap. | 83 | ;; 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 | ;; Keymap from which to inherit; may be null. | 113 | ;; Keymap from which to inherit; may be null. |
| 112 | (ancestor (mouse-major-mode-menu-1 | 114 | (ancestor (mouse-major-mode-menu-1 |
| 113 | (and (current-local-map) | 115 | (and (current-local-map) |
| 114 | (lookup-key (current-local-map) [menu-bar])))) | 116 | (local-key-binding [menu-bar])))) |
| 115 | ;; Make a keymap in which our last command leads to a menu or | 117 | ;; Make a keymap in which our last command leads to a menu or |
| 116 | ;; default to the edit menu. | 118 | ;; default to the edit menu. |
| 117 | (newmap (if ancestor | 119 | (newmap (if ancestor |
| @@ -169,6 +171,7 @@ not it is actually displayed." | |||
| 169 | (lookup-key (current-local-map) [menu-bar]))) | 171 | (lookup-key (current-local-map) [menu-bar]))) |
| 170 | (global-menu (lookup-key global-map [menu-bar])) | 172 | (global-menu (lookup-key global-map [menu-bar])) |
| 171 | (local-title-or-map (and local-menu (cadr local-menu))) | 173 | (local-title-or-map (and local-menu (cadr local-menu))) |
| 174 | (minor-mode-menus (mapcar #'cdr (minor-mode-key-binding [menu-bar]))) | ||
| 172 | (global-title-or-map (cadr global-menu))) | 175 | (global-title-or-map (cadr global-menu))) |
| 173 | ;; If the keymaps don't have prompt string (a lazy programmer | 176 | ;; If the keymaps don't have prompt string (a lazy programmer |
| 174 | ;; didn't bother to provide one), create it and insert it into the | 177 | ;; didn't bother to provide one), create it and insert it into the |
| @@ -184,9 +187,10 @@ not it is actually displayed." | |||
| 184 | (cons "Global Menu" | 187 | (cons "Global Menu" |
| 185 | (cdr global-menu))))) | 188 | (cdr global-menu))))) |
| 186 | ;; Supplying the list is faster than making a new map. | 189 | ;; Supplying the list is faster than making a new map. |
| 187 | (popup-menu (if local-menu | 190 | (popup-menu (append (list global-menu) |
| 188 | (list global-menu local-menu) | 191 | (if local-menu |
| 189 | (list global-menu)) | 192 | (list local-menu)) |
| 193 | minor-mode-menus) | ||
| 190 | event prefix))) | 194 | event prefix))) |
| 191 | 195 | ||
| 192 | (defun mouse-popup-menubar-stuff (event prefix) | 196 | (defun mouse-popup-menubar-stuff (event prefix) |