GNU bug report logs - #12406
24.2.50; frame parameter `menu-bar-lines' and `menu-bar-mode'

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Mon, 10 Sep 2012 18:01:01 UTC

Severity: normal

Found in version 24.2.50

To reply to this bug, email your comments to 12406 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Mon, 10 Sep 2012 18:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 10 Sep 2012 18:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 24.2.50; frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Mon, 10 Sep 2012 10:59:22 -0700
emacs -Q
 
(setq special-display-frame-alist '((menu-bar-lines . 1))
      special-display-regexps     '("[ ]?[*][^*]+[*]"))
(menu-bar-mode 0)
(describe-variable 'menu-bar-mode)
 
You will see that:
 
* Buffer *Help* is displayed in its own frame.
* It says that menu-bar-mode is nil (which it is).
* The frame has a menu bar.
 
I'm not sure what should be done about this, but it is confusing, at the
least.  When the mode is disabled the menu bar is (generally) not
supposed to be present.  Command `menu-bar-mode' "applies to all frames
that exist and frames to be created in the future."  That strong
statement certainly does not match not the behavior in this case.
 
Of course, someone will argue, correctly, that when frame *Help* is
created that is done with an explicit `menu-bar-lines' setting, which
should override the mode behavior.  That's why I say that I'm not sure
what, if anything, should be done about this.  But the behavior is a bit
confusing.
 
I don't have any great suggestion.  Perhaps something more could be done
wrt the doc, at least.  For example, the doc string of the mode command
could perhaps mention the frame parameter, and vice versa, explaining
that the mode is overridden by the frame parameter.  The doc for
`menu-bar-mode' should perhaps not claim so strongly that it affects
all future frames, since that is clearly not so.
 
 
FYI -
 
This came up because I received a bug report that actually had to do
with the VERY OLD bug that trying to enlarge a frame with a wide menu
bar actually shrinks the frame (horizontally, vertically).
 
Suspecting that old bug, I tried to get a repro recipe.  The user turned
off menu-bar-mode as shown above, but the symptom persisted.  The user
didn't tell me that a menu bar was actually present, so it took a while
to figure out what the problem really was.
 
That OLD bug has never been fixed, though Emacs Dev has expressed a will
to fix it at various times.
 
Here are some references to this old bug:
 
1. Bug #456.
 
2. emacs-devel thread in 2006-06 and 2007-07: "frame parameter
   menu-bar-lines changes height of frame".
 
There were also older discussions than that, but I don't have pointers
to them.

I, for one, would like to see that old bug fixed.  I, like some others,
use keys to incrementally enlarge/shrink frames horizontally/vertically,
and whenever the frame width is less than the menu-bar width, the bug
rears its ugly head.
 
It is my wish that that longstanding bug be taken off the wishlist and
treated normally - and hopefully fixed finally.
 
In GNU Emacs 24.2.50.1 (i386-mingw-nt5.1.2600)
 of 2012-09-02 on MARVIN
Bzr revision: 109861 eggert <at> cs.ucla.edu-20120902171035-7mzihil3xd6bjfiy
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.6) --no-opt --enable-checking --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include
 -ID:/devel/emacs/libs/libiconv-1.13.1-1-dev/include
 -ID:/devel/emacs/libs/libxml2-2.7.8/include/libxml2'
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Mon, 10 Sep 2012 20:41:02 GMT) Full text and rfc822 format available.

Message #8 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 12406 <at> debbugs.gnu.org
Subject: Re: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Mon, 10 Sep 2012 16:39:44 -0400
> emacs -Q
> (setq special-display-frame-alist '((menu-bar-lines . 1))
>       special-display-regexps     '("[ ]?[*][^*]+[*]"))
> (menu-bar-mode 0)
> (describe-variable 'menu-bar-mode)
 
> You will see that:
 
> * Buffer *Help* is displayed in its own frame.
> * It says that menu-bar-mode is nil (which it is).
> * The frame has a menu bar.

The core of the problem is that menu-bar-mode is global, whereas the
presence/absence of a menu-bar is actually a frame property (and it's
important to me that it be so, because I have some frames with
a menu-bar and some without).

So `menu-bar-mode' is a lie.  One possible fix is to make menu-bar-mode
into a frame-local mode, so calling menu-bar-mode would only affect the
current frame (and maybe also the future frames) but not the other
existing frames.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Mon, 10 Sep 2012 21:42:01 GMT) Full text and rfc822 format available.

Message #11 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> IRO.UMontreal.CA>
Cc: 12406 <at> debbugs.gnu.org
Subject: RE: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Mon, 10 Sep 2012 14:41:13 -0700
> The core of the problem is that menu-bar-mode is global, whereas the
> presence/absence of a menu-bar is actually a frame property (and it's
> important to me that it be so, because I have some frames with
> a menu-bar and some without).

I agree.  The frame property should override what the mode claims - as it does.

> So `menu-bar-mode' is a lie.

That was my point.  Can we fix the doc a bit to provide a slightly clearer view
- e.g., mention that the frame parameter takes precedence?

It's OK to say that the mode affects existing and future frames, but for the
future part it should probably say "unless overridden by frame parameter
`menu-bar-lines'", or some such.  That's what I meant.

> One possible fix is to make menu-bar-mode into a frame-local mode,
> so calling menu-bar-mode would only affect the
> current frame (and maybe also the future frames) but not the other
> existing frames.

To me, that would be bad - not helpful at all.  A user should be able, as now,
to set the mode and have it (1) update all existing frames and (b) affect future
frames by setting the default behavior, i.e., unless overridden.

I personally have not needed to prevent the mode change from affecting any
particular frame.  But if you did need to have some existing frame prevent the
mode change from affecting it, then we could introduce a way to specify that.
E.g., a `menu-bar-lines' value of, say, a cons (N keep).  So a value of
(menu-bar-lines 1 keep)) would keep one line and be unaffected by mode changes.

Another possibility (orthogonal) would be to let the prefix arg of
`menu-bar-mode' do double duty, to optionally affect only the current frame.
Dunno.  But I would not want that command changed to systematically affect only
the current frame.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Wed, 12 Sep 2012 08:10:03 GMT) Full text and rfc822 format available.

Message #14 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 'Stefan Monnier' <monnier <at> IRO.UMontreal.CA>, 12406 <at> debbugs.gnu.org
Subject: Re: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Wed, 12 Sep 2012 10:09:04 +0200
> A user should be able, as now,
> to set the mode and have it (1) update all existing frames

IMHO it should update a frame iff that frame has no `menu-bar-lines'
frame parameter.

> and (b) affect future
> frames by setting the default behavior, i.e., unless overridden.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Wed, 12 Sep 2012 14:15:02 GMT) Full text and rfc822 format available.

Message #17 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'martin rudalics'" <rudalics <at> gmx.at>
Cc: 'Stefan Monnier' <monnier <at> IRO.UMontreal.CA>, 12406 <at> debbugs.gnu.org
Subject: RE: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Wed, 12 Sep 2012 07:13:45 -0700
>  > A user should be able, as now,
>  > to set the mode and have it (1) update all existing frames
> 
> IMHO it should update a frame iff that frame has no `menu-bar-lines'
> frame parameter.'

Why?  Why shouldn't a user be ABLE to turn on/off showing the menu bar in all
existing frames?

One way or the other, we should find ways for users to alternatively easily do
that (affecting all existing frames) OR protect some frames from that toggling.

IOW, both should be possible and easy for the user to control interactively (not
just in Lisp; e.g., using a prefix arg or a different command).

>  > and (b) affect future
>  > frames by setting the default behavior, i.e., unless overridden.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Wed, 12 Sep 2012 15:10:02 GMT) Full text and rfc822 format available.

Message #20 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 'Stefan Monnier' <monnier <at> IRO.UMontreal.CA>, 12406 <at> debbugs.gnu.org
Subject: Re: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Wed, 12 Sep 2012 17:08:33 +0200
>> IMHO it should update a frame iff that frame has no `menu-bar-lines'
>> frame parameter.'
>
> Why?  Why shouldn't a user be ABLE to turn on/off showing the menu bar in all
> existing frames?

Because this way we'd have a consistent interface: The presence of a
frame parameter would signal "leave this frame alone".

> One way or the other, we should find ways for users to alternatively easily do
> that (affecting all existing frames) OR protect some frames from that toggling.

Do you have a practical use case where my proposal harms?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Wed, 12 Sep 2012 15:35:02 GMT) Full text and rfc822 format available.

Message #23 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'martin rudalics'" <rudalics <at> gmx.at>
Cc: 'Stefan Monnier' <monnier <at> IRO.UMontreal.CA>, 12406 <at> debbugs.gnu.org
Subject: RE: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Wed, 12 Sep 2012 08:33:46 -0700
>  >> IMHO it should update a frame iff that frame has no 
>  >> `menu-bar-lines' frame parameter.'
>  >
>  > Why?  Why shouldn't a user be ABLE to turn on/off showing 
>  > the menu bar in all existing frames?
> 
> Because this way we'd have a consistent interface: The presence of a
> frame parameter would signal "leave this frame alone".

That's inconsistent with the convention that absence of a frame parameter is
equivalent to its presence with a nil value.  It is similar to proposing that we
give some  special signification to the absense of a key in an alist, as opposed
to a key with value nil.

Please find another way to say "leave this frame alone".  That should not be
difficult, and it should be possible to find something that has general
applicability (i.e., any frames, any frame parameter, any function that affects
a frame parameter).

More precisely, we should be able to say "leave this frame alone for parameter
BLAH".  And even perhaps "make function FOO leave this frame alone for parameter
BLAH".  In this case, FOO is `menu-bar-mode' and BLAH is `menu-bar-lines'.

And this should be 100% orthogonal to the presence or absence of the parameter,
and 100% orthogonal to what the parameter's current value (nil or not) might be.

>  > One way or the other, we should find ways for users to 
>  > alternatively easily do that (affecting all existing
>  > frames) OR protect some frames from that toggling.
> 
> Do you have a practical use case where my proposal harms?

You are unnecessarily coupling things that do not belong together.  That's a bad
idea.  Whether a given parameter should be affected  by a given function is
logically unrelated to whether the parameter is currently present for a given
frame, and is logically unrelated to the parameter's current value for a given
frame.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Wed, 12 Sep 2012 16:49:01 GMT) Full text and rfc822 format available.

Message #26 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 'Stefan Monnier' <monnier <at> IRO.UMontreal.CA>, 12406 <at> debbugs.gnu.org
Subject: Re: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Wed, 12 Sep 2012 18:48:02 +0200
>> Because this way we'd have a consistent interface: The presence of a
>> frame parameter would signal "leave this frame alone".
>
> That's inconsistent with the convention that absence of a frame parameter is
> equivalent to its presence with a nil value.  It is similar to proposing that we
> give some  special signification to the absense of a key in an alist, as opposed
> to a key with value nil.

You're probably right.

> You are unnecessarily coupling things that do not belong together.  That's a bad
> idea.  Whether a given parameter should be affected  by a given function is
> logically unrelated to whether the parameter is currently present for a given
> frame, and is logically unrelated to the parameter's current value for a given
> frame.

Maybe.  I never understood things like `tool-bar-lines-needed'.

martin




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Wed, 12 Sep 2012 17:44:01 GMT) Full text and rfc822 format available.

Message #29 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'martin rudalics'" <rudalics <at> gmx.at>
Cc: 'Stefan Monnier' <monnier <at> IRO.UMontreal.CA>, 12406 <at> debbugs.gnu.org
Subject: RE: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Wed, 12 Sep 2012 10:42:43 -0700
> I never understood things like `tool-bar-lines-needed'.

I never even heard of it before.

But I'm not surprised that such things exist.  The Emacs tool bar has a history
of ugly little hacks and cruftiness.

Oddly enough, BTW, `tool-bar-lines-needed' does not seem to appear anywhere in
the Emacs Lisp code!  It is defined in C for Lisp, but is not used anywhere (in
Emacs 24, at least).





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Wed, 12 Sep 2012 17:55:02 GMT) Full text and rfc822 format available.

Message #32 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 'Stefan Monnier' <monnier <at> IRO.UMontreal.CA>, 12406 <at> debbugs.gnu.org
Subject: Re: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Wed, 12 Sep 2012 19:53:27 +0200
> Oddly enough, BTW, `tool-bar-lines-needed' does not seem to appear anywhere in
> the Emacs Lisp code!  It is defined in C for Lisp, but is not used anywhere (in
> Emacs 24, at least).

I use it now for frame resizing.

martin





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Wed, 12 Sep 2012 18:04:02 GMT) Full text and rfc822 format available.

Message #35 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'martin rudalics'" <rudalics <at> gmx.at>
Cc: 'Stefan Monnier' <monnier <at> IRO.UMontreal.CA>, 12406 <at> debbugs.gnu.org
Subject: RE: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Wed, 12 Sep 2012 11:02:09 -0700
> > > I never understood things like `tool-bar-lines-needed'.
> >
> > Oddly enough, BTW, `tool-bar-lines-needed' does not seem to 
> > appear anywhere in the Emacs Lisp code!  It is defined in C
> > for Lisp, but is not used anywhere (in Emacs 24, at least).
> 
> I use it now for frame resizing.

Proof that in this case one need not understand it to make use of it! ;-)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Thu, 13 Sep 2012 03:19:01 GMT) Full text and rfc822 format available.

Message #38 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 'martin rudalics' <rudalics <at> gmx.at>, 12406 <at> debbugs.gnu.org
Subject: Re: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Wed, 12 Sep 2012 23:17:13 -0400
>> Because this way we'd have a consistent interface: The presence of a
>> frame parameter would signal "leave this frame alone".
> That's inconsistent with the convention that absence of a frame
> parameter is equivalent to its presence with a nil value.  It is
> similar to proposing that we give some  special signification to the
> absense of a key in an alist, as opposed to a key with value nil.

Agreed.  That means, all frames should have a `menu-bar-lines'
parameter, set to `default' in most of them.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12406; Package emacs. (Thu, 13 Sep 2012 04:07:02 GMT) Full text and rfc822 format available.

Message #41 received at 12406 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Stefan Monnier'" <monnier <at> iro.umontreal.ca>
Cc: 'martin rudalics' <rudalics <at> gmx.at>, 12406 <at> debbugs.gnu.org
Subject: RE: bug#12406: 24.2.50;
	frame parameter `menu-bar-lines' and `menu-bar-mode'
Date: Wed, 12 Sep 2012 21:05:57 -0700
> >> Because this way we'd have a consistent interface: The 
> >> presence of a frame parameter would signal "leave this
> >> frame alone".
> >
> > That's inconsistent with the convention that absence of a frame
> > parameter is equivalent to its presence with a nil value.  It is
> > similar to proposing that we give some  special signification to the
> > absense of a key in an alist, as opposed to a key with value nil.
> 
> Agreed.  That means, all frames should have a `menu-bar-lines'
> parameter, set to `default' in most of them.

Sounds reasonable.  The devil might be in the details of what you want to do
with/about it.  But yes, that sounds like a start.





This bug report was last modified 12 years and 275 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.