all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jared Finder via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: philipk@posteo.net, 68765@debbugs.gnu.org,
	monnier@iro.umontreal.ca, juri@linkov.net
Subject: bug#68765: 30.0.50; Adding window-tool-bar package.
Date: Wed, 22 May 2024 21:19:05 -0700	[thread overview]
Message-ID: <1d18b11671667fefa925dbc41423d547@finder.org> (raw)
In-Reply-To: <86pltib8m7.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1053 bytes --]

On 2024-05-18 23:48, Eli Zaretskii wrote:
>> Date: Sat, 18 May 2024 20:58:05 -0700
>> From: Jared Finder <jared@finder.org>
>> Cc: juri@linkov.net, 68765@debbugs.gnu.org, philipk@posteo.net,
>>  monnier@iro.umontreal.ca
>> 
>> On 2024-05-18 02:48, Eli Zaretskii wrote:
>> >> I think after these patches are applied, the remaining work to resolve
>> >> this would be having the ELPA package added and me updating NEWS and
>> >> the
>> >> manual.  I can start on the updates.
>> >
>> > I installed the patches on the master branch.
>> 
>> Thank you!
>> 
>> Is there anything else that needs to be done to get this package on
>> ELPA?  I'd like to use this package on older Emacsen as well.
> 
> Philip will tell, but what I meant was to ask you to work on updates
> for NEWS and the manual.

Patch attached.  I'm still not comfortable with all the texinfo 
conventions, so please review that I'm using things like @code 
correctly.

Also, I couldn't figure out how to get the Top node menus to auto 
update, so I just manually put in new nodes.

   -- MJF

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Adding-documentation-for-window-tool-bar.patch --]
[-- Type: text/x-diff; name=0001-Adding-documentation-for-window-tool-bar.patch, Size: 13078 bytes --]

From c7930bc626e70430f91d3cd6eb2536949d2884a1 Mon Sep 17 00:00:00 2001
From: Jared Finder <jared@finder.org>
Date: Mon, 20 May 2024 21:59:14 -0700
Subject: [PATCH] Adding documentation for window-tool-bar

* doc/emacs/emacs.texi (Top):
* doc/emacs/frames.texi (Tool Bars):
* doc/emacs/glossary.texi (Glossary):
* doc/emacs/modes.texi (Minor Modes): Mention Window Tool Bar
and add xref.
* doc/emacs/windows.texi (Windows, Tab Line): New documentation.
* doc/lispref/elisp.texi (Top):
* doc/lispref/modes.texi (Mode Line Format, Mode Line Basics)
(Mode Line Data): Mention Tab Lines and add xref.
(Tab Lines): New documentation.
* etc/NEWS: Mention newly added variable
'tool-bar-always-show-default' and new package 'window-tool-bar'
---
 doc/emacs/emacs.texi    |  1 +
 doc/emacs/frames.texi   | 14 +++++++----
 doc/emacs/glossary.texi | 10 ++++----
 doc/emacs/modes.texi    |  4 ++++
 doc/emacs/windows.texi  | 39 ++++++++++++++++++++++++++++++
 doc/lispref/elisp.texi  |  1 +
 doc/lispref/modes.texi  | 53 ++++++++++++++++++++++++++++++-----------
 etc/NEWS                | 14 +++++++++++
 8 files changed, 114 insertions(+), 22 deletions(-)

diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 7d77f13ab21..8246041fb95 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -529,6 +529,7 @@ Top
 * Temporary Displays::  Displaying non-editable buffers.
 * Window Convenience::  Convenience functions for window handling.
 * Tab Line::            Window tab line.
+* Window Tool Bar::     A tool bar that is attached to windows.
 
 Displaying a Buffer in a Window
 
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 6c62fde4ffb..8028a516e66 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -1295,16 +1295,22 @@ Menu Bars
 @node Tool Bars
 @section Tool Bars
 @cindex tool bar mode
+@cindex tool bar, attached to frame
 @cindex mode, Tool Bar
 @cindex icons, toolbar
 
-  On graphical displays, Emacs puts a @dfn{tool bar} at the top of
-each frame, just below the menu bar.  This is a row of icons which you
-can click on with the mouse to invoke various commands.
+  On graphical displays, Emacs puts a @dfn{tool bar} at the top of each
+frame, just below the menu bar.  This is a row of icons which you can
+click on with the mouse to invoke various commands.  Emacs can also
+optionally display a tool bar at the top of each window (@pxref{Window
+Tool Bar}).
 
+@vindex tool-bar-always-show-default
   The global (default) tool bar contains general commands.  Some major
 modes define their own tool bars; whenever a buffer with such a major
-mode is current, the mode's tool bar replaces the global tool bar.
+mode is current, the mode's tool bar replaces the global tool bar.  To
+prevent this replacement from happening, customize the variable
+@code{tool-bar-always-show-default}.
 
 @findex tool-bar-mode
 @vindex tool-bar-mode
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi
index 344e4831f36..b30e1d789fc 100644
--- a/doc/emacs/glossary.texi
+++ b/doc/emacs/glossary.texi
@@ -1436,10 +1436,12 @@ Glossary
 for your favorite set of faces (q.v.).
 
 @item Tool Bar
-The tool bar is a line (sometimes multiple lines) of icons at the top
-of an Emacs frame.  Clicking on one of these icons executes a command.
-You can think of this as a graphical relative of the menu bar (q.v.).
-@xref{Tool Bars}.
+The tool bar is a line (sometimes multiple lines) of icons at the top of
+an Emacs frame.  Clicking on one of these icons executes a command.  You
+can think of this as a graphical relative of the menu bar (q.v.).
+@xref{Tool Bars}.  There is also a window tool bar that behaves
+similarly, but is at the top of an Emacs window.  @xref{Window Tool
+Bar}.
 
 @anchor{Glossary---Tooltips}
 @item Tooltips
diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi
index 2776dc72a27..253042b28a3 100644
--- a/doc/emacs/modes.texi
+++ b/doc/emacs/modes.texi
@@ -295,6 +295,10 @@ Minor Modes
 but the tool bar is only displayed on graphical terminals.  @xref{Tool
 Bars}.
 
+@item
+Window Tool Bar mode gives windows a tool bar when it is different from
+the default tool bar.  @xref{Window Tool Bar}.
+
 @item
 Tab Bar mode gives each frame a tab bar.  @xref{Tab Bars}.
 
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi
index ad2225b5922..1c0aaeb1c92 100644
--- a/doc/emacs/windows.texi
+++ b/doc/emacs/windows.texi
@@ -22,6 +22,7 @@ Windows
 * Displaying Buffers::  How Emacs picks a window for displaying a buffer.
 * Window Convenience::  Convenience functions for window handling.
 * Tab Line::            Window tab line.
+* Window Tool Bar::     A tool bar that is attached to windows.
 @end menu
 
 @node Basic Window
@@ -689,3 +690,41 @@ Tab Line
 switch between window configurations containing several windows with buffers,
 tabs on the Tab Line at the top of each window are used to switch
 between buffers in the window.
+
+
+@node Window Tool Bar
+@cindex mode, Window Tool Bar
+@cindex tool bar, attached to window
+
+@findex global-window-tool-bar-mode
+@vindex global-window-tool-bar-mode
+  The command @code{global-window-tool-bar-mode} toggles the display of
+a tool bar at the top of all windows.  (You can also customize the
+variable @code{global-window-tool-bar-mode}.)  To conserve space, a
+window tool bar is only shown if the tool bar for a buffer is different
+from the global (default) tool bar.  The most common way a buffer has a
+different tool bar is due to its major mode, so you can think of the
+window tool bar as showing a major mode's tool bar if it exists.
+
+@findex window-tool-bar-mode
+If you want to toggle the display of a tool bar in just a single window,
+run the command @code{window-tool-bar-mode}.  This is also useful to put
+in a hook.  For example if you want the window tool bar to appear for
+all buffers that do not represent files and have a custom tool bar, you
+could add the following code to your init file (@pxref{Init File}):
+
+@example
+(add-hook 'special-mode-hook 'window-tool-bar-mode)
+@end example
+
+Emacs can also display a tool bar at the top of frames (@pxref{Tool
+Bars}).  When showing a tool bar at the top of frames as well as
+windows, you may want to have the frame tool bar not change based on the
+current buffer's major mode.  This can be done by customizing the
+variable @code{tool-bar-always-show-default}.
+
+Note that the window tool bar displays in the same space as the tab
+line, so only one of these can be display at a time unless you customize
+the value of @code{tab-line-format} in Lisp.  In this case, add
+@code{(:eval (window-tool-bar-strng))} to @code{tab-line-format}.
+@xref{Mode Line Format,,, elisp, The Emacs Lisp Reference Manual}.
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 339272d1f05..1059d0dcf61 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -925,6 +925,7 @@ Top
 * %-Constructs::            Putting information into a mode line.
 * Properties in Mode::      Using text properties in the mode line.
 * Header Lines::            Like a mode line, but at the top.
+* Tab Lines::               A line that is above the header line.
 * Emulating Mode Line::     Formatting text as the mode line would.
 
 Font Lock Mode
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index cf67b319924..6ee1d869fb8 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -2074,14 +2074,14 @@ Mode Line Format
 line at the bottom, which displays status information about the buffer
 displayed in the window.  The mode line contains information about the
 buffer, such as its name, associated file, depth of recursive editing,
-and major and minor modes.  A window can also have a @dfn{header
-line}, which is much like the mode line but appears at the top of the
-window.
+and major and minor modes.  A window can also have a @dfn{header line}
+and a @dfn{tab line}, which are much like the mode line but they appear
+at the top of the window.
 
-  This section describes how to control the contents of the mode line
-and header line.  We include it in this chapter because much of the
-information displayed in the mode line relates to the enabled major and
-minor modes.
+  This section describes how to control the contents of the mode line,
+header line, and tab line.  We include it in this chapter because much
+of the information displayed in the mode line relates to the enabled
+major and minor modes.
 
 @menu
 * Base: Mode Line Basics.       Basic ideas of mode line control.
@@ -2091,6 +2091,7 @@ Mode Line Format
 * %-Constructs::                Putting information into a mode line.
 * Properties in Mode::          Using text properties in the mode line.
 * Header Lines::                Like a mode line, but at the top.
+* Tab Lines::                   A line that is above the header line.
 * Emulating Mode Line::         Formatting text as the mode line would.
 @end menu
 
@@ -2101,11 +2102,13 @@ Mode Line Basics
 variable @code{mode-line-format} (@pxref{Mode Line Top}).  This variable
 holds a @dfn{mode line construct}: a template that controls what is
 displayed on the buffer's mode line.  The value of
-@code{header-line-format} specifies the buffer's header line in the same
-way.  All windows for the same buffer use the same
-@code{mode-line-format} and @code{header-line-format} unless a
-@code{mode-line-format} or @code{header-line-format} parameter has been
-specified for that window (@pxref{Window Parameters}).
+@code{header-line-format} and @code{tab-line-format} specifies the
+buffer's header line and tab line in the same way.  All windows for the
+same buffer use the same @code{mode-line-format},
+@code{header-line-format}, and @code{tab-line-format} unless a
+@code{mode-line-format}, @code{header-line-format}, or
+@code{tab-line-format} parameter has been specified for that window
+(@pxref{Window Parameters}).
 
   For efficiency, Emacs does not continuously recompute each window's
 mode line and header line.  It does so when circumstances appear to call
@@ -2167,8 +2170,8 @@ Mode Line Data
 @dfn{mode line construct}, made up of lists, strings, symbols, and
 numbers kept in buffer-local variables.  Each data type has a specific
 meaning for the mode line appearance, as described below.  The same data
-structure is used for constructing frame titles (@pxref{Frame Titles})
-and header lines (@pxref{Header Lines}).
+structure is used for constructing frame titles (@pxref{Frame Titles}),
+header lines (@pxref{Header Lines}), and tab lines (@pxref{Tab Lines}).
 
   A mode line construct may be as simple as a fixed string of text,
 but it usually specifies how to combine fixed strings with variables'
@@ -2816,6 +2819,28 @@ Header Lines
 header line at once; if it has a mode line, then it does not display a
 header line.
 
+@node Tab Lines
+@subsection Window Tab Lines
+@cindex tab line (of a window)
+@cindex window tab line
+
+  A window can have a @dfn{tab line} at the top.  If both the tab line
+and header line are visible, the tab line appears above the header line.
+The tab line feature works just like the mode line feature, except that
+it's controlled by @code{tab-line-format}:
+
+@defvar tab-line-format
+This variable, local in every buffer, specifies how to display the tab
+line, for windows displaying the buffer.  The format of the value is the
+same as for @code{mode-line-format} (@pxref{Mode Line Data}).  It is
+normally @code{nil}, so that ordinary buffers have no tab line.
+@end defvar
+
+@defun window-tab-line-height &optional window
+This function returns the height in pixels of @var{window}'s tab line.
+@var{window} must be a live window, and defaults to the selected window.
+@end defun
+
 @node Emulating Mode Line
 @subsection Emulating Mode Line Formatting
 
diff --git a/etc/NEWS b/etc/NEWS
index d72ef5b5bef..7b829f5002c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -240,6 +240,12 @@ window systems other than Nextstep.
 When this minor mode is enabled, buttons representing modifier keys
 are displayed along the tool bar.
 
++++
+** New user option 'tool-bar-always-show-default'.
+This can be set so that the tool bar at the top of a frame does not show
+buffer local customization of the tool bar.  This is convenient when
+using the newly added 'global-window-tool-bar-mode'.
+
 +++
 ** "d" in the mode line now indicates that the window is dedicated.
 Windows have always been able to be dedicated to a specific buffer;
@@ -1877,6 +1883,14 @@ than regular expressions, but less complexity than context-free
 grammars.  The Info manual "(elisp) Parsing Expression Grammars" has
 documentation and examples.
 
++++
+** New package Window-Tool-Bar.
+This provides a new minor mode, 'window-tool-bar-mode'.  When this minor
+mode is enabled, a tool bar is displayed at the top of a window if the
+buffer in the window has a buffer local tool bar, commonly from its
+major mode.  The global minor mode 'global-window-tool-bar-mode' enables
+this minor mode in all buffers.
+
 \f
 * Incompatible Lisp Changes in Emacs 30.1
 
-- 
2.39.2


  reply	other threads:[~2024-05-23  4:19 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-27 23:36 bug#68765: 30.0.50; Adding window-tool-bar package Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-10  8:19 ` Eli Zaretskii
2024-02-10 17:25   ` Juri Linkov
2024-02-26 22:38     ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-26 15:34       ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-27  7:04         ` Juri Linkov
2024-05-02  6:03           ` Juri Linkov
2024-05-09  8:00             ` Eli Zaretskii
2024-05-10  4:24               ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-11  4:33                 ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-12 16:34                   ` Juri Linkov
2024-05-14  4:14                     ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-14  6:01                       ` Juri Linkov
2024-05-18  9:50                         ` Eli Zaretskii
2024-05-19  3:55                           ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-19  6:43                             ` Eli Zaretskii
2024-05-20 17:14                         ` Juri Linkov
2024-05-21  2:25                           ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-21  6:12                             ` Juri Linkov
2024-05-18  9:45                       ` Eli Zaretskii
2024-05-18  9:48                       ` Eli Zaretskii
2024-05-19  3:58                         ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-19  6:48                           ` Eli Zaretskii
2024-05-23  4:19                             ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-05-23  6:52                               ` Eli Zaretskii
2024-05-25 15:49                                 ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-25 17:03                                   ` Eli Zaretskii
2024-05-25 19:54                                     ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-26  9:44                                       ` Eli Zaretskii
2024-05-26 16:20                                         ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-26 18:40                                           ` Eli Zaretskii
2024-06-02  4:17                                             ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-02  5:21                                               ` Eli Zaretskii
2024-06-02 15:57                                                 ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-02 16:46                                                   ` Eli Zaretskii
2024-05-19 14:41                           ` Philip Kaludercic
2024-05-20  3:25                             ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-20  6:39                               ` Philip Kaludercic
2024-05-20  9:19                               ` Philip Kaludercic
2024-05-21  4:18                                 ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-21 13:40                                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-22 16:16                                   ` Philip Kaludercic
2024-02-11 20:51 ` Philip Kaludercic
2024-02-27  3:02 ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-03-26 15:33   ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13  7:43     ` Eli Zaretskii
2024-04-27  8:25       ` Eli Zaretskii
2024-04-27 10:00   ` Philip Kaludercic
2024-04-28  4:44     ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-04  5:24 ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-04 15:59   ` Eli Zaretskii
2024-06-05  4:22     ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-05 12:10       ` Eli Zaretskii
2024-06-09  0:29         ` Jared Finder via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-09 12:23           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1d18b11671667fefa925dbc41423d547@finder.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=68765@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=jared@finder.org \
    --cc=juri@linkov.net \
    --cc=monnier@iro.umontreal.ca \
    --cc=philipk@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.