I do exactly that in Menu-Bar+ (code: menu-bar+.el
.
This is what I do, for that. First, I add a divider pseudo-menu:
(defvar menu-bar-divider-menu (make-sparse-keymap "Divider"))
(define-key global-map [menu-bar divider] (cons "||" menu-bar-divider-menu))
(define-key menu-bar-divider-menu [menu-bar-divider-hint]
'("<-- Current mode menus to left. || Common menus to right -->"
. describe-menubar))
Then I move all of the standard menus, plus a couple Menu-Bar+ menus, to menu-bar-final-items
:
(setq menu-bar-final-items
(append '(divider file edit options buffer tools search)
(and (boundp 'menu-bar-frames-menu) '(frames))
(and (boundp 'menu-bar-doremi-menu) '(doremi))
'(help-menu)
(and (fboundp 'show-tool-bar-for-one-command) '(pop-up-tool-bar))))
You can click the divider, \\
, to show help about the menu bar (command describe-menubar
), which is this (it describes the predefined menus for Menu-Bar+):
(defun describe-menubar ()
"Explain the menu bar, in general terms."
(interactive)
(with-output-to-temp-buffer "*Help*"
(princ (substitute-command-keys
"To the right of the menu bar divider (\"||\") are the general menus
that usually appear in every buffer. To the left of this symbol, there
may also be additional menus that are specific to the buffer's mode
\(use `\\[describe-mode]' for information on a buffer's mode).
The general menus are as follows:
Buffers File Tools Edit Frames Do Re Mi Help
Use the \"Frames\" menu to resize, tile, and hide/show frames.
Use the \"Do Re Mi\" menu to incrementally change things.
The \"Help\" menu extends the \"Help\" menu described in the Emacs manual (`\\[info]').
For information on a menu item, use the \"This\" item in the \"Describe\"
submenu of the \"Help\" menu."))
(if (fboundp 'help-print-return-message)
(help-print-return-message)
(print-help-return-message))
(with-current-buffer standard-output
(help-mode)
(buffer-string)))) ; Return the text we displayed.
Because local menus are added before menu-bar-final-items
, then end up at the left of the menu-bar. So the effect is to have, from left to right: local menus, divider, non-local menus.