The Emacs menu bar places mode-specific menus after most of the default menu items, but before the "Help" menu*. Specifically: "File", "Edit", "Options", "Buffers", "Tools", mode-specific menu items, "Help". For example:

  • Lisp Interaction mode:

    Emacs menu bar in Lisp interaction mode

  • Prolog mode:

    Emacs menu bar in Prolog mode

Is there a way to rearrange the menu items such that the mode-specific menu items always appear before all the other menu items? For example, in Lisp Interaction mode, I would like the "Lisp-Interaction" menu item to be the first menu item (i.e. appearing to before "File").

* The "Help" menu always appears last because of the variable menu-bar-final-items which is '(help-menu) by default.

2 Answers 2


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))
              (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."
  (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)
    (with-current-buffer standard-output
      (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.


Change the value of the variable menu-bar-final-items:

(setq menu-bar-final-items '(file edit options buffer tools help-menu))

Example results:

  • Lisp Interaction mode:

    Rearranged Emacs menu bar in Lisp Interaction mode

  • Prolog mode:

    Rearranged Emacs menu bar in Prolog mode

The menu bar has been changed to show mode-specific menu items first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.