Search code examples
emacsmenubar

Remove the Emacs menu bar


I tried Prelude - WikEmacs,

Every time I open emacs, there is a menu bar at the top:

File Edit Options Buffers Tools Emacs-Lisp Prelude Projectile Help

enter image description here

How can I remove it or prevent it from being shown?


Solution

  • You can disable the menu bar by turning off minor mode menu-bar-mode. C-h f menu-bar-mode tells you this:

    menu-bar-mode is an interactive compiled Lisp function in menu-bar.el.

    (menu-bar-mode &optional ARG)

    Toggle display of a menu bar on each frame (Menu Bar mode).

    With a prefix argument ARG, enable Menu Bar mode if ARG is positive, and disable it otherwise. If called from Lisp, also enable Menu Bar mode if ARG is omitted or nil.

    This command applies to all frames that exist and frames to be created in the future.

    So to turn it off using Lisp, for example in your init file (~/.emacs), you can do this:

    (menu-bar-mode -1)

    That description of turning the mode on/off interactively and from Lisp is general for minor modes.

    Unfortunately, that doc string does not tell you that menu-bar-mode is a minor mode or that minor modes generally follow the same rules for turning them on/off. But if you click the link in that *Help* output to go to the definition of menu-bar-mode in menu-bar.el then you'll see that it's defined using macro define-minor-mode.

    And C-h f define-minor-mode gives you general information about turning on/off a minor mode.