* bug#31020: 27.0; Please provide a way to know about menu-bar wrapping
@ 2018-04-02 3:03 Drew Adams
2018-04-02 6:08 ` Eli Zaretskii
2019-09-28 18:42 ` Stefan Kangas
0 siblings, 2 replies; 9+ messages in thread
From: Drew Adams @ 2018-04-02 3:03 UTC (permalink / raw)
To: 31020
Enhancement request.
When a frame is narrower than the text in the
menu-bar, that text is wrapped. And yet the value of frame parameter
`menu-bar-lines' is not increased (which is good).
It would be good to be able to know (from Elisp) how many "visual"
(effective) menu-bar lines there are currently, that is, how many times
the menu-bar text is wrapped. (It is typically wrapped zero or one
time, producing text that appears visually to be two lines.)
In GNU Emacs 27.0.50 (build 3, x86_64-w64-mingw32)
of 2018-03-21
Repository revision: e70d0c9e66d7a8609450b2889869d16aeb0363b5
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --without-dbus --host=x86_64-w64-mingw32
--without-compress-install -C 'CFLAGS=-O2 -static -g3''
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31020: 27.0; Please provide a way to know about menu-bar wrapping
2018-04-02 3:03 bug#31020: 27.0; Please provide a way to know about menu-bar wrapping Drew Adams
@ 2018-04-02 6:08 ` Eli Zaretskii
2018-04-02 8:54 ` martin rudalics
2019-09-28 18:42 ` Stefan Kangas
1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2018-04-02 6:08 UTC (permalink / raw)
To: Drew Adams; +Cc: 31020
> Date: Sun, 1 Apr 2018 20:03:00 -0700 (PDT)
> From: Drew Adams <drew.adams@oracle.com>
>
> When a frame is narrower than the text in the
> menu-bar, that text is wrapped. And yet the value of frame parameter
> `menu-bar-lines' is not increased (which is good).
>
> It would be good to be able to know (from Elisp) how many "visual"
> (effective) menu-bar lines there are currently, that is, how many times
> the menu-bar text is wrapped. (It is typically wrapped zero or one
> time, producing text that appears visually to be two lines.)
I don't understand why you think that the menu-bar-lines parameter
should not be it. AFAIU, the problem with setting it (or any other
frame parameter) to the actual value is that with many toolkits Emacs
simply doesn't know the correct value. But maybe Martin will have
some trick up his sleeves.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31020: 27.0; Please provide a way to know about menu-bar wrapping
2018-04-02 6:08 ` Eli Zaretskii
@ 2018-04-02 8:54 ` martin rudalics
2018-04-02 13:32 ` Drew Adams
0 siblings, 1 reply; 9+ messages in thread
From: martin rudalics @ 2018-04-02 8:54 UTC (permalink / raw)
To: Eli Zaretskii, Drew Adams; +Cc: 31020
> I don't understand why you think that the menu-bar-lines parameter
> should not be it. AFAIU, the problem with setting it (or any other
> frame parameter) to the actual value is that with many toolkits Emacs
> simply doesn't know the correct value. But maybe Martin will have
> some trick up his sleeves.
I am not aware of any toolkit telling us that number or whether the
current menu bar was wrapped at all. It's nowhere in the various API
descriptions and I suppose the information usually gets lost somewhere
in between calculations of which font the user's theme wants for the
menu bar and how that affects wrapping. I'm not even sure whether
some toolkit would deliberately truncate our menu bar when it doesn't
fit into one line. And lets not talk about GTK auto-resizing our
frame when the menu bar gets too long.
So what you can do is the following: Make a frame with a _visibly
unwrapped_ menu bar, get the menu bar height via
(cddr (assq 'menu-bar-size (frame-geometry)))
Do the same for a frame with a _visibly wrapped_ two-lines menu bar.
You can now derive the height of the single-line and any additional
menu bar line and use these values together with 'frame-geometry' for
getting the actual number of lines.
Obviously, this will work only as long as you do not change themes,
the menu bar height of the current theme or the resolution of your
screen or whatever else could affect this. And since you have to
visuallly check the "wrappedness" of the menu bar, this work cannot be
reasonably done from within Emacs.
martin
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31020: 27.0; Please provide a way to know about menu-bar wrapping
2018-04-02 8:54 ` martin rudalics
@ 2018-04-02 13:32 ` Drew Adams
0 siblings, 0 replies; 9+ messages in thread
From: Drew Adams @ 2018-04-02 13:32 UTC (permalink / raw)
To: martin rudalics, Eli Zaretskii; +Cc: 31020
> So what you can do is the following: Make a frame with a _visibly
> unwrapped_ menu bar, get the menu bar height via
> (cddr (assq 'menu-bar-size (frame-geometry)))
>
> Do the same for a frame with a _visibly wrapped_ two-lines menu bar.
> You can now derive the height of the single-line and any additional
> menu bar line and use these values together with 'frame-geometry' for
> getting the actual number of lines.
That's good to know; thanks. But I don't think it will
help code that has only a given frame to examine, e.g.,
code that doesn't want to bother some user by creating
or resizing frames to determine this. And anyway, the
_code_ cannot, by itself, tell the _visibly wrapped_
condition.
IOW, that suggestion might help a user to determine,
by looking, what the situation is. But I don't see how
I could use in from Lisp to know what the situation is.
Let me know, if I'm missing something simple.
> Obviously, this will work only as long as you do not change themes,
> the menu bar height of the current theme or the resolution of your
> screen or whatever else could affect this. And since you have to
> visuallly check the "wrappedness" of the menu bar, this work cannot be
> reasonably done from within Emacs.
Ah, that's just what I meant above. Thanks for confirming.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31020: 27.0; Please provide a way to know about menu-bar wrapping
2018-04-02 3:03 bug#31020: 27.0; Please provide a way to know about menu-bar wrapping Drew Adams
2018-04-02 6:08 ` Eli Zaretskii
@ 2019-09-28 18:42 ` Stefan Kangas
1 sibling, 0 replies; 9+ messages in thread
From: Stefan Kangas @ 2019-09-28 18:42 UTC (permalink / raw)
To: martin rudalics; +Cc: 31020
tags 31020 + wontfix
close 31020
quit
martin rudalics <rudalics@gmx.at> writes:
>> I don't understand why you think that the menu-bar-lines parameter
>> should not be it. AFAIU, the problem with setting it (or any other
>> frame parameter) to the actual value is that with many toolkits Emacs
>> simply doesn't know the correct value. But maybe Martin will have
>> some trick up his sleeves.
>
> I am not aware of any toolkit telling us that number or whether the
> current menu bar was wrapped at all. It's nowhere in the various API
> descriptions and I suppose the information usually gets lost somewhere
> in between calculations of which font the user's theme wants for the
> menu bar and how that affects wrapping. I'm not even sure whether
> some toolkit would deliberately truncate our menu bar when it doesn't
> fit into one line. And lets not talk about GTK auto-resizing our
> frame when the menu bar gets too long.
>
> So what you can do is the following: Make a frame with a _visibly
> unwrapped_ menu bar, get the menu bar height via
>
> (cddr (assq 'menu-bar-size (frame-geometry)))
>
> Do the same for a frame with a _visibly wrapped_ two-lines menu bar.
> You can now derive the height of the single-line and any additional
> menu bar line and use these values together with 'frame-geometry' for
> getting the actual number of lines.
>
> Obviously, this will work only as long as you do not change themes,
> the menu bar height of the current theme or the resolution of your
> screen or whatever else could affect this. And since you have to
> visuallly check the "wrappedness" of the menu bar, this work cannot be
> reasonably done from within Emacs.
It seems like the conclusion here is that the feature suggestion is not
practical, so I'm closing it as wontfix.
If this is incorrect, please reopen the bug.
Best regards,
Stefan Kangas
^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <<37c99926-a5e5-4fa8-b734-6f9c146740e9@default>]
end of thread, other threads:[~2019-09-28 18:42 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-02 3:03 bug#31020: 27.0; Please provide a way to know about menu-bar wrapping Drew Adams
2018-04-02 6:08 ` Eli Zaretskii
2018-04-02 8:54 ` martin rudalics
2018-04-02 13:32 ` Drew Adams
2019-09-28 18:42 ` Stefan Kangas
[not found] <<37c99926-a5e5-4fa8-b734-6f9c146740e9@default>
[not found] ` <<837epq6sxx.fsf@gnu.org>
2018-04-02 13:25 ` Drew Adams
2018-04-03 6:49 ` martin rudalics
2018-04-03 14:28 ` Drew Adams
2018-04-04 7:49 ` martin rudalics
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.