Function: menu-bar-mode

menu-bar-mode is an interactive and byte-compiled function defined in menu-bar.el.gz.

Signature

(menu-bar-mode &optional ARG)

Documentation

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

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

This is a global minor mode. If called interactively, toggle the Menu-Bar mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate the variable menu-bar-mode(var)/menu-bar-mode(fun).

The mode's hook is called both when the mode is enabled and when it is disabled.

View in manual

Probably introduced at or before Emacs version 19.30.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/menu-bar.el.gz
(define-minor-mode menu-bar-mode
  "Toggle display of a menu bar on each frame (Menu Bar mode).

This command applies to all frames that exist and frames to be
created in the future."
  :init-value t
  :global t
  ;; It's defined in C/cus-start, this stops the d-m-m macro defining it again.
  :variable menu-bar-mode

  ;; Turn the menu-bars on all frames on or off.
  (let ((val (if menu-bar-mode 1 0)))
    (dolist (frame (frame-list))
      (set-frame-parameter frame 'menu-bar-lines val))
    ;; If the user has given `default-frame-alist' a `menu-bar-lines'
    ;; parameter, replace it.
    (if (assq 'menu-bar-lines default-frame-alist)
	(setq default-frame-alist
	      (cons (cons 'menu-bar-lines val)
		    (assq-delete-all 'menu-bar-lines
				     default-frame-alist)))))
  ;; Make the message appear when Emacs is idle.  We can not call message
  ;; directly.  The minor-mode message "Menu Bar mode disabled" comes
  ;; after this function returns, overwriting any message we do here.
  (when (and (called-interactively-p 'interactive) (not menu-bar-mode))
    (run-with-idle-timer 0 nil 'message
                         (substitute-command-keys
                          "Menu Bar mode disabled.  \
Use \\[menu-bar-mode] to make the menu bar appear."))))