From: Juri Linkov Date: Wed, 20 Oct 2021 16:50:29 +0000 (+0300) Subject: * lisp/tab-bar.el (tab-bar-menu-bar): New command (bug#51247). X-Git-Tag: emacs-28.0.90~234 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=06fe499614dcb3e13ee795b5aa80ebc8687f2fe2;p=emacs.git * 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'. --- diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 03556919b20..a3316bf4496 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.