diff options
| author | Juri Linkov | 2021-10-21 19:55:24 +0300 |
|---|---|---|
| committer | Juri Linkov | 2021-10-21 19:55:24 +0300 |
| commit | 1cdb4d2077c4e402bf2b2991e8395f0ccdedd1d1 (patch) | |
| tree | 3e8415c29852089dbe3ad55bfd951a762896f4a0 | |
| parent | 0545c70c168d2cc3f4fa794312b23f2616f67327 (diff) | |
| download | emacs-1cdb4d2077c4e402bf2b2991e8395f0ccdedd1d1.tar.gz emacs-1cdb4d2077c4e402bf2b2991e8395f0ccdedd1d1.zip | |
* lisp/menu-bar.el (menu-bar-keymap): Add optional arg KEYMAP (bug#50067).
* lisp/mouse.el (context-menu-global): Use 'menu-bar-keymap' with
its arg KEYMAP set to 'global-map'.
| -rw-r--r-- | lisp/menu-bar.el | 9 | ||||
| -rw-r--r-- | lisp/mouse.el | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 1cc126b5017..f19dc9e7c97 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -2696,10 +2696,13 @@ This command is to be used when you click the mouse in the menubar." | |||
| 2696 | (cdr menu-bar-item-cons) | 2696 | (cdr menu-bar-item-cons) |
| 2697 | 0)))) | 2697 | 0)))) |
| 2698 | 2698 | ||
| 2699 | (defun menu-bar-keymap () | 2699 | (defun menu-bar-keymap (&optional keymap) |
| 2700 | "Return the current menu-bar keymap. | 2700 | "Return the current menu-bar keymap. |
| 2701 | The ordering of the return value respects `menu-bar-final-items'. | ||
| 2701 | 2702 | ||
| 2702 | The ordering of the return value respects `menu-bar-final-items'." | 2703 | It's possible to use the KEYMAP argument to override the default keymap |
| 2704 | that is the currently active maps. For example, the argument KEYMAP | ||
| 2705 | could provide `global-map' where items are limited to the global map only." | ||
| 2703 | (let ((menu-bar '()) | 2706 | (let ((menu-bar '()) |
| 2704 | (menu-end '())) | 2707 | (menu-end '())) |
| 2705 | (map-keymap | 2708 | (map-keymap |
| @@ -2712,7 +2715,7 @@ The ordering of the return value respects `menu-bar-final-items'." | |||
| 2712 | ;; sorting. | 2715 | ;; sorting. |
| 2713 | (push (cons pos menu-item) menu-end) | 2716 | (push (cons pos menu-item) menu-end) |
| 2714 | (push menu-item menu-bar)))) | 2717 | (push menu-item menu-bar)))) |
| 2715 | (lookup-key (menu-bar-current-active-maps) [menu-bar])) | 2718 | (lookup-key (or keymap (menu-bar-current-active-maps)) [menu-bar])) |
| 2716 | `(keymap ,@(nreverse menu-bar) | 2719 | `(keymap ,@(nreverse menu-bar) |
| 2717 | ,@(mapcar #'cdr (sort menu-end | 2720 | ,@(mapcar #'cdr (sort menu-end |
| 2718 | (lambda (a b) | 2721 | (lambda (a b) |
diff --git a/lisp/mouse.el b/lisp/mouse.el index bcb58d153a8..7bac6dd07bf 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -364,7 +364,7 @@ Some context functions add menu items below the separator." | |||
| 364 | (when (consp binding) | 364 | (when (consp binding) |
| 365 | (define-key-after menu (vector key) | 365 | (define-key-after menu (vector key) |
| 366 | (copy-sequence binding)))) | 366 | (copy-sequence binding)))) |
| 367 | (lookup-key global-map [menu-bar])) | 367 | (menu-bar-keymap global-map)) |
| 368 | menu) | 368 | menu) |
| 369 | 369 | ||
| 370 | (defun context-menu-local (menu _click) | 370 | (defun context-menu-local (menu _click) |