emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-28 06fe499: * lisp/tab-bar.el (tab-bar-menu-bar): New command (bug


From: Juri Linkov
Subject: emacs-28 06fe499: * lisp/tab-bar.el (tab-bar-menu-bar): New command (bug#51247).
Date: Wed, 20 Oct 2021 12:50:50 -0400 (EDT)

branch: emacs-28
commit 06fe499614dcb3e13ee795b5aa80ebc8687f2fe2
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/tab-bar.el (tab-bar-menu-bar): New command (bug#51247).
    
    (tab-bar-format): Rename option 'tab-bar-format-menu-global' to
    'tab-bar-format-menu-bar'.
    (tab-bar-format-menu-bar): Rename from 'tab-bar-format-menu-global'.
---
 lisp/tab-bar.el | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 0355691..a3316bf 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -715,7 +715,7 @@ it will display time aligned to the right on the tab bar 
instead
 of the mode line.  Replacing `tab-bar-format-tabs' with
 `tab-bar-format-tabs-groups' will group tabs on the tab bar."
   :type 'hook
-  :options '(tab-bar-format-menu-global
+  :options '(tab-bar-format-menu-bar
              tab-bar-format-history
              tab-bar-format-tabs
              tab-bar-format-tabs-groups
@@ -730,22 +730,23 @@ of the mode line.  Replacing `tab-bar-format-tabs' with
   :group 'tab-bar
   :version "28.1")
 
-(defun tab-bar-format-menu-global ()
-  "Produce the Menu button for the tab bar that shows a global menu."
-  `((add-tab menu-item (propertize "Menu" 'face 'tab-bar-tab-inactive)
-             (lambda (event) (interactive "e")
-               (let ((menu (make-sparse-keymap
-                            (propertize "Global Menu" 'hide t))))
-
-                 (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
-                 (map-keymap (lambda (key binding)
-                               (when (consp binding)
-                                 (define-key-after menu (vector key)
-                                   (copy-sequence binding))))
-                             (lookup-key global-map [menu-bar]))
-
-                 (popup-menu menu event)))
-             :help "Global Menu")))
+(defun tab-bar-menu-bar (event)
+  "Pop up the same menu as displayed by the menu bar.
+Used by `tab-bar-format-menu-bar'."
+  (interactive "e")
+  (let ((menu (make-sparse-keymap (propertize "Menu Bar" 'hide t))))
+    (run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
+    (map-keymap (lambda (key binding)
+                  (when (consp binding)
+                    (define-key-after menu (vector key)
+                      (copy-sequence binding))))
+                (menu-bar-keymap))
+    (popup-menu menu event)))
+
+(defun tab-bar-format-menu-bar ()
+  "Produce the Menu button for the tab bar that shows the menu bar."
+  `((menu-bar menu-item (propertize "Menu" 'face 'tab-bar-tab-inactive)
+     tab-bar-menu-bar :help "Menu Bar")))
 
 (defun tab-bar-format-history ()
   "Produce back and forward buttons for the tab bar.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]