bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#68765: 30.0.50; Adding window-tool-bar package.


From: Jared Finder
Subject: bug#68765: 30.0.50; Adding window-tool-bar package.
Date: Mon, 03 Jun 2024 22:24:55 -0700

On 2024-06-02 09:46, Eli Zaretskii wrote:
Date: Sun, 02 Jun 2024 08:57:52 -0700
From: Jared Finder <jared@finder.org>
Cc: juri@linkov.net, 68765@debbugs.gnu.org, philipk@posteo.net,
 monnier@iro.umontreal.ca
Let me explicitly describe the terms I am using:

When I write "the global (default) tool bar", that refers to the value
of (default-value 'tool-bar-map).  It's the tool bar with New File,
Open File, Open Directory, Kill Buffer, Save, Undo, Cut, Copy, Paste,
Isearch.  This doesn't change with major mode.  As far as I can tell,
it doesn't change during normal Emacs operations (unless a user chooses
to modify it, of course).

When I write "the frame tool bar", that refers to the tool bar
displayed at the top of a frame, as controlled by M-x tool-bar-mode.
There is no change of behavior here except for the new user option
tool-bar-always-show-default.

When I write "the window tool bar", that refers to the tool bar
displayed at the top of a window, as controlled by (newly added) M-x
window-tool-bar-mode or M-x global-window-tool-bar-mode.  The window
tool bar displays the value of tool-bar-map the window's displayed
buffer.  But it only displays that tool bar if it is not the same as
the global (default) tool bar.  It does not pay attention to the frame
tool bar.  Specifically, the test is:

 (eq tool-bar-map ;a buffer's tool bar
     (default-value 'tool-bar-map) ;the global (default) tool bar
  )

So a window under, say, Info mode will show the Info tool bar even
though the frame also shows that tool bar, just because that tool bar
is different from the default value of tool-bar-map?  Why is this
behavior useful?

How about if we make the behavior simpler and more predictable:

  If a window's buffer has a non-nil value of window-toolbar-mode,
  show the window-specific tool bar regardless of what it is and
  whether it is the same as the default.

Why is this not good enough?

I want the window-specfic tool bar to never be shown if there are no tool bar buttons, to conserve space. However, if tab-line-format is non nil, the tab line takes up space even if the resulting tab line is nil. This can happen if one sets the default tool bar to nil, while keeping the mode specific tool bars.

I think there's also a useful case where the frame tool bar is used to show a "global" tool bar with buttons that do not act on the current buffer (in the current default tool bar: new file, open file, open directory, all the modifier tool bar buttons) and the window tool bar is used to show buttons that act on the buffer. In this case, you don't want the "global" tool bar to change based on frame's selected window. The "tool-bar-always-show-default" variable I added as well as the logic with ignoring the default value of tool-bar-map was to enable this use case. I treat the default value of tool-bar-map as "no tool bar buttons for this window" since all those buttons are for the global tool bar. It'd be fine to limit behavior to only when tool-bar-always-show-default was set.

  -- MJF





reply via email to

[Prev in Thread] Current Thread [Next in Thread]