Subject: bug#6037: 24.0.50; menu-bar-mode function doesn't toggle

From: Joe Brenner <[email-masked]>
Date: Mon, 26 Apr 2010 10:41:19 -0700

Stefan Monnier <[email-masked]> wrote:

> > The menu-bar-mode function is not working as a toggle.
>
> See etc/NEWS.

So I gather you're referring to this:

  * Incompatible Lisp Changes in Emacs 24.1

  ** Test for special mode-class was moved from view-file to view-buffer.

  ** Passing a nil argument to a minor mode function now turns the mode
   ON unconditionally.

You're of the opinion that using "nil" to turn on a minor-mode is actually
correct behavior?

And the important justification for breaking long-standing behavior
was... ?

> If you really want to toggle (I've never seen such a case from Elisp),
> just do (menu-bar-mode 'toggle).

Okay, thanks for the hint.  Is that documented anywhere?

If you'd like a use-case in elisp, I've been doing this in some form
of or another for quite some time:

  ;------------
  ; luddite mode
  (tool-bar-mode -1)
  (global-set-key [f12] '(lambda ()
                           (interactive)
                           (menu-bar-mode -1)
                           (scroll-bar-mode)
                           (setq use-dialog-box nil)
                           ))

> > Note that running scroll-bar-mode repeatedly does work as a toggle, as
> > expected for menu-bar-mode:
> >   (scroll-bar-mode)
>
> Yes, that's a bug that I hope to fix before Emacs-24.
> I.e. better not rely on it.

Allow me to quote the documentation for menu-bar-mode:

  "Toggle display of a menu bar on each frame."

And again for scroll-bar-mode:

  "Toggle display of vertical scroll bars on all frames."