unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
@ 2010-04-26  7:38 Joseph Brenner
  2010-04-26 13:42 ` Stefan Monnier
  2011-09-21 19:37 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 12+ messages in thread
From: Joseph Brenner @ 2010-04-26  7:38 UTC (permalink / raw)
  To: 6037


The menu-bar-mode function is not working as a toggle.
Running this will turn on the menu bar, but running it again
will not turn it off:

  (menu-bar-mode)

This does work to turn it off:
  (menu-bar-mode -1)

This turns it on, as documented:
  (menu-bar-mode 1)

Note that running scroll-bar-mode repeatedly does work as a toggle, as
expected for menu-bar-mode:

  (scroll-bar-mode)

I used to use this code, and it *did* work as a toggle (possibly in error):

  (menu-bar-mode nil)

I've verified this bug with when invoked with -Q.


In GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.16.1)
 of 2010-04-25 on fineline
Windowing system distributor `The X.Org Foundation', version 11.0.10600000
configured using `configure  '--prefix' '/usr/local/emacs/bzr-042510''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  global-semanticdb-minor-mode: t
  semantic-mode: t
  global-ede-mode: t
  shell-dirtrack-mode: t
  show-paren-mode: t
  display-time-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<return> C-x C-p M-f M-f M-f M-f M-b M-d - 1 C-x C-e
C-e C-x C-e C-x C-e C-n M-b M-d - 1 C-e C-x C-e C-x
C-e C-p C-n C-n C-n C-n M-f M-b M-d - <backspace> n
i l C-x C-s C-a C-n C-l C-p C-p C-p C-l C-n C-n C-p
C-p M-f M-f M-f M-f M-b M-d - 1 C-f C-x C-e C-a C-n
C-x C-s C-p C-p C-l C-x 1 C-n C-k C-x C-o C-x C-s C-p
C-p C-p C-p C-p C-p C-n M-f M-f M-f C-f C-k C-a C-n
C-x C-s C-p C-p C-SPC C-n C-n C-n C-n C-n C-n C-n C-n
C-n M-w C-p C-e C-x C-e <f12> <f12> <f12> <f12> C-p
C-p C-p C-p C-e C-b <backspace> <backspace> <backspace>
C-n C-e C-b <backspace> <backspace> <backspace> C-n
C-n C-n C-x C-e <f12> <f12> <f12> <f12> <f12> <f12>
<f12> <f12> C-p C-p C-p C-p M-b C-e C-b SPC - 1 C-e
C-x C-e C-n C-n C-n C-n C-n C-p C-x C-e <f12> <f12>
C-p C-p C-p C-p C-e SPC ; ; SPC T O D O S-SPC b u g
: SPC w o n ' t SPC t o g g l e C-x C-s C-a C-k C-y
C-x C-s C-n M-x e m a v <backspace> c s SPC v e r SPC
<return> M-x b u g SPC e m SPC <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> e m
a SPC b u SPC <backspace> <backspace> <backspace> <backspace>
<backspace> <backspace> <backspace> <backspace> b u
g SPC SPC SPC C-g C-x C-g M-h i C-a C-n C-x b <return>
M-x a p r SPC <return> b u g <return> C-x o C-n C-s
r e p o r t C-s C-s C-s C-s C-s C-a C-SPC C-e M-w C-x
C-p M-x C-y <return>

Recent messages:
Saving file /home/doom/lib/emacs/Dots/emacs-setup.el...
Wrote /home/doom/lib/emacs/Dots/emacs-setup.el
Mark set
Saving file /home/doom/lib/emacs/Dots/emacs-setup.el...
Wrote /home/doom/lib/emacs/Dots/emacs-setup.el
GNU Emacs 24.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.16.1) of 2010-04-25 on fineline
Making completion list...
Quit
Mark saved where search started
Mark set

Load-path shadows:
/home/doom/End/Cave/DesktopAutosave/lib/emacs/desktop-recover-setup hides /home/doom/lib/emacs/Dots/desktop-recover-setup
/home/doom/End/Cave/DiredExternalApps/lib/emacs/image-dired hides /home/doom/lib/emacs/image-dired
/home/doom/End/Cave/DiredExternalApps/lib/emacs/dired-external-apps hides /home/doom/lib/emacs/dired-external-apps
/home/doom/lib/emacs/Dots/setup-colors-dark hides /home/doom/lib/emacs/setup-colors-dark
/home/doom/End/Cave/DiredExternalApps/lib/emacs/image-dired hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/image-dired
/home/doom/lib/emacs/Dots/strokes hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/strokes
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-thread hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-thread
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-funcs hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-funcs
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-alias hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-alias
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-letter hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-letter
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-buffers hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-buffers
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-print hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-print
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-mime hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-mime
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-xface hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-xface
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-junk hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-junk
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-identity hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-identity
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-tool-bar hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-tool-bar
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-gnus hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-gnus
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-limit hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-limit
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-scan hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-scan
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-loaddefs hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-loaddefs
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-show hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-show
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-folder hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-folder
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-search hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-search
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-seq hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-seq
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-e hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-e
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-comp hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-comp
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-compat hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-compat
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-utils hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-utils
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-inc hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-inc
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-speed hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-speed
/usr/local/emacs/cvs-040510/share/emacs/23.1.90/lisp/mh-e/mh-acros hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/mh-e/mh-acros
/home/doom/lib/emacs/Dots/gnus-setup hides /usr/local/emacs/bzr-042510/share/emacs/24.0.50/lisp/gnus/gnus-setup

Features:
(shadow sort mail-extr message rfc822 mail-utils gmm-utils mailheader
warnings emacsbug apropos pp help-mode view grep mule-util sql inversion
semantic/db-file cedet-files semantic/bovine/c semantic/decorate/include
semantic/db-find semantic/db-ref semantic/decorate/mode
semantic/decorate pulse semantic/bovine/c-by semantic/lex-spp
semantic/bovine/gcc semantic/dep semantic/analyze semantic/sort
semantic/scope semantic/analyze/fcn nroff-mode ede/dired vc-git vc-bzr
sha1 hex-util html-mode jsp-html-helper-mode asp-html-helper-mode
php-html-helper-mode html-helper-mode tempo cc-mode cc-fonts cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs sgml-mode sh-script
executable info flymake compile vc-rcs multi-isearch thingatpt desktop
desktop-recover desktop-recover-setup doom-fineline ansi-color
registers-defined image-mode junk-dired junk-setup datestamps
live-dangerously strokes macroman doom-filters find_and_replace doom-mh
mh-comp sendmail mh-scan mh-gnus mml mml-sec mm-view smime
password-cache dig mailcap mm-decode mm-bodies mm-encode mail-parse
rfc2231 rfc2047 rfc2045 ietf-drums mm-util mail-prsvr gnus-util mh-e
mh-compat mailabbrev mh-acros mh-buffers mh-loaddefs mhe-setup
fugly-keystroke-macros dired-imagery-doomery-keystroke-macros
image-dired thinknow picture doomfile doomfiles-hacking-setup
caving-setup w3m-load html-setup perlnow-x perlnow template
perlnow-setup sepia sepia-cpan sepia-ido ido sepia-tree tree-widget
sepia-w3m w3m-perldoc w3m browse-url timezone w3m-hist w3m-e22 w3m-ccl
ccl w3m-fsf w3m-favicon w3m-image w3m-proc w3m-util gud easy-mmode
cperl-mode sepia-setup semantic/db-mode semantic/db semantic/idle
semantic/format semantic/tag-ls semantic/ctxt semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw mode-local
ede/linux ede/emacs ede/cpp-root ede/speedbar ede/files ede ede/source
eieio-base eieio-speedbar speedbar sb-image ezimage dframe easymenu
assoc eieio-custom wid-edit eieio cedet apache-dev perl-setup
elisp-hacking-setup doom-print printer-setup shell-setup perlups derived
byte-opt bytecomp byte-compile jka-compr find-func timeclock-x timeclock
timeclock-setup shell comint ring dired-external-apps dired-setup
save-to-registers basic-keymap-changes paracide redroot
simple-color-change setup-colors-dark man-apropos edmacro kmacro
zoom-frm frame-cmds frame-fns avoid zoom-frm-setup text-setup dired-x
dired-aux dired regexp-opt paren uniquify advice help-fns advice-preload
server time emacs-setup cl cl-19 load-path-setup tooltip ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
fringe lisp-mode register page menu-bar rfn-eshadow timer select
scroll-bar mldrag mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev loaddefs button minibuffer faces cus-face files
text-properties overlay md5 base64 format env code-pages mule custom
widget hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting gtk x-toolkit x
multi-tty emacs)







^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-26  7:38 bug#6037: 24.0.50; menu-bar-mode function doesn't toggle Joseph Brenner
@ 2010-04-26 13:42 ` Stefan Monnier
  2010-04-26 14:13   ` Lennart Borgman
  2010-04-26 17:41   ` Joe Brenner
  2011-09-21 19:37 ` Lars Magne Ingebrigtsen
  1 sibling, 2 replies; 12+ messages in thread
From: Stefan Monnier @ 2010-04-26 13:42 UTC (permalink / raw)
  To: Joseph Brenner; +Cc: 6037

> The menu-bar-mode function is not working as a toggle.

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

> 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.


        Stefan






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-26 13:42 ` Stefan Monnier
@ 2010-04-26 14:13   ` Lennart Borgman
  2010-04-26 17:38     ` Stefan Monnier
  2010-04-26 17:41   ` Joe Brenner
  1 sibling, 1 reply; 12+ messages in thread
From: Lennart Borgman @ 2010-04-26 14:13 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 6037, Joseph Brenner

On Mon, Apr 26, 2010 at 3:42 PM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>> The menu-bar-mode function is not working as a toggle.
>
> See etc/NEWS.
> If you really want to toggle (I've never seen such a case from Elisp),
> just do (menu-bar-mode 'toggle).

Aren't they common in menus?






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-26 14:13   ` Lennart Borgman
@ 2010-04-26 17:38     ` Stefan Monnier
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2010-04-26 17:38 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: 6037, Joseph Brenner

>>> The menu-bar-mode function is not working as a toggle.
>> See etc/NEWS.
>> If you really want to toggle (I've never seen such a case from Elisp),
>> just do (menu-bar-mode 'toggle).
> Aren't they common in menus?

In that case, they're not called from Elisp, AFAIK.
I.e. it will go through the `interactive' spec which will provide the
`toggle' arg.


        Stefan






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-26 13:42 ` Stefan Monnier
  2010-04-26 14:13   ` Lennart Borgman
@ 2010-04-26 17:41   ` Joe Brenner
  2010-04-27  3:05     ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: Joe Brenner @ 2010-04-26 17:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 6037


Stefan Monnier <monnier@iro.umontreal.ca> 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."







^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-26 17:41   ` Joe Brenner
@ 2010-04-27  3:05     ` Stefan Monnier
  2010-04-27  6:38       ` Joe Brenner
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2010-04-27  3:05 UTC (permalink / raw)
  To: Joe Brenner; +Cc: 6037

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

Yes.

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

It fixes a lot of

  (add-hook 'foo-mode 'toto-minor-mode)

where the coder assumed unconsciously that toto-minor-mode was not
yet enabled.

>> 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?

Not yet.

> 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)
>                            ))

I don't know what this is meant to do, so I don't see where you need the
toggle behavior.

Note that in Emacs-23, when calling a minor-mode with nil (or no)
argument to turn it off, it usually outputted a warning (because
practice showed that such calls are usually erroneous).

> 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."

And indeed M-x menu-bar-mode toggles, just like M-x scroll-bar-mode.
Only the non-interactive calls are affected.


        Stefan







^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-27  3:05     ` Stefan Monnier
@ 2010-04-27  6:38       ` Joe Brenner
  2010-04-27 13:42         ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Joe Brenner @ 2010-04-27  6:38 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 6037


Stefan Monnier <monnier@iro.umontreal.ca> wrote:

> > 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)
> >                            ))
>
> I don't know what this is meant to do, so I don't see where you need the
> toggle behavior.

Well the ideal is that hitting f12 should enable or disable the various
gui features that I typically don't care about such as the menu-bar and
so on.  Admittedly, the above code is a hack in an inbetween state.
Currently I have it revised like so:

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

(defun doom-toggle-use-dialog-box ()
  "Toggle the use-dialog-box setting"
  (interactive)
  (setq use-dialog-box
        (cond (use-dialog-box
               nil)
              (t
               nil)
              )))

> Note that in Emacs-23, when calling a minor-mode with nil (or no)
> argument to turn it off, it usually outputted a warning (because
> practice showed that such calls are usually erroneous).

I've never noticed this with (menu-bar-mode) or (scroll-bar-mode).

> > 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."
>
> And indeed M-x menu-bar-mode toggles, just like M-x scroll-bar-mode.
> Only the non-interactive calls are affected.

And indeed, that difference is (a) not documented and (b) not the way it
used to behave.

But hey, what do I know, I'm only a mere user, I should know better than
to argue with our glorious masters.  It's no doubt very silly of me to
think that the code inferace for emacs might've settled down around
version 23.









^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-27  6:38       ` Joe Brenner
@ 2010-04-27 13:42         ` Stefan Monnier
  2010-04-27 15:27           ` Drew Adams
  2010-04-28  5:42           ` Kevin Rodgers
  0 siblings, 2 replies; 12+ messages in thread
From: Stefan Monnier @ 2010-04-27 13:42 UTC (permalink / raw)
  To: Joe Brenner; +Cc: 6037

> Well the ideal is that hitting f12 should enable or disable the various
> gui features that I typically don't care about such as the menu-bar and
> so on.  Admittedly, the above code is a hack in an inbetween state.
> Currently I have it revised like so:

> (global-set-key [f12] '(lambda ()
>                          (interactive)
>                          (menu-bar-mode   'toggle)
>                          (scroll-bar-mode 'toggle)
>                          (doom-toggle-use-dialog-box)
>                          ))

That makes sense.  But then I'd recommend the code below instead:

> (global-set-key [f12] (lambda ()
>                         (interactive)
>                         (call-interactively 'menu-bar-mode)
>                         (call-interactively 'scroll-bar-mode)
>                         (doom-toggle-use-dialog-box)))

which will have the following impact:
- it will tell customize about those changes (so "M-x customize-variable
  RET menu-bar-mode" will not complain about a variable set from
  outside, and it will let you save the current state.
- You should be able to do C-u -1 f12 to forcibly turn off
  and C-u 1 f12 to forcibly turn on those GUI elements.
- You'll get a minibuffer messages about the menu-bar-mode being
  enabled/disabled.
- It will work across "all" Emacs versions (the above code will already
  work with emacs-2[234] and I'm not sure which other versions have
  menu-bar-mode and scroll-bar-mode, so maybe it's not that big
  a difference).


        Stefan






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-27 13:42         ` Stefan Monnier
@ 2010-04-27 15:27           ` Drew Adams
  2010-04-28  5:42           ` Kevin Rodgers
  1 sibling, 0 replies; 12+ messages in thread
From: Drew Adams @ 2010-04-27 15:27 UTC (permalink / raw)
  To: 'Stefan Monnier', 'Joe Brenner'; +Cc: 6037

> > (global-set-key [f12] '(lambda ()
> >                          (interactive)
> >                          (menu-bar-mode   'toggle)
> >                          (scroll-bar-mode 'toggle)
> >                          (doom-toggle-use-dialog-box)
> >                          ))
> 
> That makes sense.  But then I'd recommend the code below instead:
>
> > (global-set-key [f12] (lambda ()
> >                         (interactive)
> >                         (call-interactively 'menu-bar-mode)
> >                         (call-interactively 'scroll-bar-mode)
> >                         (doom-toggle-use-dialog-box)))
> 
> which will have the following impact:
> - it will tell customize about those changes (so "M-x 
> customize-variable
>   RET menu-bar-mode" will not complain about a variable set from
>   outside, and it will let you save the current state.
> - You should be able to do C-u -1 f12 to forcibly turn off
>   and C-u 1 f12 to forcibly turn on those GUI elements.
> - You'll get a minibuffer messages about the menu-bar-mode being
>   enabled/disabled.
> - It will work across "all" Emacs versions (the above code 
> will already
>   work with emacs-2[234] and I'm not sure which other versions have
>   menu-bar-mode and scroll-bar-mode, so maybe it's not that big
>   a difference).

This is the kind of thing that should be added to the doc. Many users will make
use of something like this in their init files. They need to be aware of pretty
much all of the things you point out.







^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-27 13:42         ` Stefan Monnier
  2010-04-27 15:27           ` Drew Adams
@ 2010-04-28  5:42           ` Kevin Rodgers
  2010-04-28 14:43             ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: Kevin Rodgers @ 2010-04-28  5:42 UTC (permalink / raw)
  To: bug-gnu-emacs

Stefan Monnier wrote:
>> Well the ideal is that hitting f12 should enable or disable the various
>> gui features that I typically don't care about such as the menu-bar and
>> so on.  Admittedly, the above code is a hack in an inbetween state.
>> Currently I have it revised like so:
> 
>> (global-set-key [f12] '(lambda ()
>>                          (interactive)
>>                          (menu-bar-mode   'toggle)
>>                          (scroll-bar-mode 'toggle)
>>                          (doom-toggle-use-dialog-box)
>>                          ))
> 
> That makes sense.  But then I'd recommend the code below instead:
> 
>> (global-set-key [f12] (lambda ()
>>                         (interactive)
>>                         (call-interactively 'menu-bar-mode)
>>                         (call-interactively 'scroll-bar-mode)
>>                         (doom-toggle-use-dialog-box)))
> 
> which will have the following impact:
> - it will tell customize about those changes (so "M-x customize-variable
>   RET menu-bar-mode" will not complain about a variable set from
>   outside, and it will let you save the current state.

Really?  What is the connection between call-interactively and customize?

> - You should be able to do C-u -1 f12 to forcibly turn off
>   and C-u 1 f12 to forcibly turn on those GUI elements.

Really?  In the past I've had to bind prefix-arg to the value of
current-prefix-arg around call-interactively, to get the "interior"
command to inherit the prefix arg of the exterior command.

> - You'll get a minibuffer messages about the menu-bar-mode being
>   enabled/disabled.

Why doesn't scroll-bar-mode display the same messages?

> - It will work across "all" Emacs versions (the above code will already
>   work with emacs-2[234] and I'm not sure which other versions have
>   menu-bar-mode and scroll-bar-mode, so maybe it's not that big
>   a difference).

(FOO-bar-mode nil) should also toggle across those versions (and older versions)
  -- but does it?

-- 
Kevin Rodgers
Denver, Colorado, USA








^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-28  5:42           ` Kevin Rodgers
@ 2010-04-28 14:43             ` Stefan Monnier
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2010-04-28 14:43 UTC (permalink / raw)
  To: Kevin Rodgers; +Cc: bug-gnu-emacs

>> - it will tell customize about those changes (so "M-x customize-variable
>> RET menu-bar-mode" will not complain about a variable set from
>> outside, and it will let you save the current state.
> Really?  What is the connection between call-interactively and customize?

No direct connect, but minor modes defined with define-minor-mode will
check if they're called via call-interactively to decide whether to tell
customize about the change (if not called interactively, there's no way
for Customize to know whether the change could interfere with Customize
or not).

>> - You should be able to do C-u -1 f12 to forcibly turn off
>> and C-u 1 f12 to forcibly turn on those GUI elements.
> Really?  In the past I've had to bind prefix-arg to the value of
> current-prefix-arg around call-interactively, to get the "interior"
> command to inherit the prefix arg of the exterior command.

Hmm... you might be right.

>> - You'll get a minibuffer messages about the menu-bar-mode being
>> enabled/disabled.
> Why doesn't scroll-bar-mode display the same messages?

Because there's only one minibuffer, so you only see one of
the messages.
In this case it happens to be the first rather than the second.

>> - It will work across "all" Emacs versions (the above code will already
>> work with emacs-2[234] and I'm not sure which other versions have
>> menu-bar-mode and scroll-bar-mode, so maybe it's not that big
>> a difference).

> (FOO-bar-mode nil) should also toggle across those versions (and older
> versions)

No, for Emacs-24 it will not toggle.


        Stefan







^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#6037: 24.0.50; menu-bar-mode function doesn't toggle
  2010-04-26  7:38 bug#6037: 24.0.50; menu-bar-mode function doesn't toggle Joseph Brenner
  2010-04-26 13:42 ` Stefan Monnier
@ 2011-09-21 19:37 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 12+ messages in thread
From: Lars Magne Ingebrigtsen @ 2011-09-21 19:37 UTC (permalink / raw)
  To: Joseph Brenner; +Cc: 6037

Joseph Brenner <doom@kzsu.stanford.edu> writes:

> The menu-bar-mode function is not working as a toggle.
> Running this will turn on the menu bar, but running it again
> will not turn it off:
>
>   (menu-bar-mode)
>
> This does work to turn it off:
>   (menu-bar-mode -1)
>
> This turns it on, as documented:
>   (menu-bar-mode 1)
>
> Note that running scroll-bar-mode repeatedly does work as a toggle, as
> expected for menu-bar-mode:
>
>   (scroll-bar-mode)
>
> I used to use this code, and it *did* work as a toggle (possibly in error):
>
>   (menu-bar-mode nil)
>
> I've verified this bug with when invoked with -Q.

This seems to be intended behaviour and isn't a bug, so I'm closing this
report.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-09-21 19:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-26  7:38 bug#6037: 24.0.50; menu-bar-mode function doesn't toggle Joseph Brenner
2010-04-26 13:42 ` Stefan Monnier
2010-04-26 14:13   ` Lennart Borgman
2010-04-26 17:38     ` Stefan Monnier
2010-04-26 17:41   ` Joe Brenner
2010-04-27  3:05     ` Stefan Monnier
2010-04-27  6:38       ` Joe Brenner
2010-04-27 13:42         ` Stefan Monnier
2010-04-27 15:27           ` Drew Adams
2010-04-28  5:42           ` Kevin Rodgers
2010-04-28 14:43             ` Stefan Monnier
2011-09-21 19:37 ` Lars Magne Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).