diff options
| author | Jared Finder | 2024-06-08 17:23:58 -0700 |
|---|---|---|
| committer | Eli Zaretskii | 2024-06-09 15:21:34 +0300 |
| commit | a5c0d682b10fa60925641c6abc3a5dbee024fa46 (patch) | |
| tree | d8ad62800a6d19bc37b5dc03f3ca87d4df930d3b | |
| parent | 7f8ded2a85d551c6e3303eaca1697bbd7b9427ef (diff) | |
| download | emacs-a5c0d682b10fa60925641c6abc3a5dbee024fa46.tar.gz emacs-a5c0d682b10fa60925641c6abc3a5dbee024fa46.zip | |
Add documentation for window-tool-bar package
Also change window-tool-mode to not pay attention to if
tool-bar-map has a buffer local value or not as that made the
documentation complicated. Documentation added in Emacs manual,
Elisp manual, package commentary, and docstrings. Also extend
window-tool-bar support to Emacs 27 and newer. (bug#68765)
* doc/emacs/emacs.texi (Top):
* doc/emacs/frames.texi (Menu Bars):
* doc/emacs/glossary.texi (Glossary):
* doc/emacs/modes.texi (Minor Modes):
* doc/emacs/windows.texi (Windows, Tab Line): Mention Window
Tool Bar.
(Window Tool Bar): New documentation.
* doc/lispref/elisp.texi (Top):
* doc/lispref/modes.texi (Mode Line Format, Mode Line Basics)
(Mode Line Data): Mention Tab Lines.
(Tab Lines): New documentation.
* etc/NEWS: Mention newly added variable and package.
* lisp/window-tool-bar.el (window-tool-bar-mode): Don't display
tool bar when tool-bar-map is nil.
* lisp/window-tool-bar.el (tool-bar-always-show-default): Define
variable for older Emacs versions.
| -rw-r--r-- | doc/emacs/emacs.texi | 1 | ||||
| -rw-r--r-- | doc/emacs/frames.texi | 14 | ||||
| -rw-r--r-- | doc/emacs/glossary.texi | 10 | ||||
| -rw-r--r-- | doc/emacs/modes.texi | 3 | ||||
| -rw-r--r-- | doc/emacs/windows.texi | 43 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 1 | ||||
| -rw-r--r-- | doc/lispref/modes.texi | 56 | ||||
| -rw-r--r-- | etc/NEWS | 12 | ||||
| -rw-r--r-- | lisp/window-tool-bar.el | 27 |
9 files changed, 135 insertions, 32 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 @@ Multiple Windows | |||
| 529 | * Temporary Displays:: Displaying non-editable buffers. | 529 | * Temporary Displays:: Displaying non-editable buffers. |
| 530 | * Window Convenience:: Convenience functions for window handling. | 530 | * Window Convenience:: Convenience functions for window handling. |
| 531 | * Tab Line:: Window tab line. | 531 | * Tab Line:: Window tab line. |
| 532 | * Window Tool Bar:: A tool bar that is attached to windows. | ||
| 532 | 533 | ||
| 533 | Displaying a Buffer in a Window | 534 | Displaying a Buffer in a Window |
| 534 | 535 | ||
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi index 6c62fde4ffb..e1fbf9768af 100644 --- a/doc/emacs/frames.texi +++ b/doc/emacs/frames.texi | |||
| @@ -1295,16 +1295,22 @@ menus' visual appearance. | |||
| 1295 | @node Tool Bars | 1295 | @node Tool Bars |
| 1296 | @section Tool Bars | 1296 | @section Tool Bars |
| 1297 | @cindex tool bar mode | 1297 | @cindex tool bar mode |
| 1298 | @cindex tool bar, attached to frame | ||
| 1298 | @cindex mode, Tool Bar | 1299 | @cindex mode, Tool Bar |
| 1299 | @cindex icons, toolbar | 1300 | @cindex icons, toolbar |
| 1300 | 1301 | ||
| 1301 | On graphical displays, Emacs puts a @dfn{tool bar} at the top of | 1302 | On graphical displays, Emacs puts a @dfn{tool bar} at the top of each |
| 1302 | each frame, just below the menu bar. This is a row of icons which you | 1303 | frame, just below the menu bar. This is a row of buttons with icons |
| 1303 | can click on with the mouse to invoke various commands. | 1304 | which you can click on with the mouse to invoke various commands. Emacs |
| 1305 | can also optionally display a tool bar at the top of each window | ||
| 1306 | (@pxref{Window Tool Bar}). | ||
| 1304 | 1307 | ||
| 1308 | @vindex tool-bar-always-show-default | ||
| 1305 | The global (default) tool bar contains general commands. Some major | 1309 | The global (default) tool bar contains general commands. Some major |
| 1306 | modes define their own tool bars; whenever a buffer with such a major | 1310 | modes define their own tool bars; whenever a buffer with such a major |
| 1307 | mode is current, the mode's tool bar replaces the global tool bar. | 1311 | mode is current, the mode's tool bar replaces the global tool bar. To |
| 1312 | prevent this replacement from happening, customize the variable | ||
| 1313 | @code{tool-bar-always-show-default}. | ||
| 1308 | 1314 | ||
| 1309 | @findex tool-bar-mode | 1315 | @findex tool-bar-mode |
| 1310 | @vindex tool-bar-mode | 1316 | @vindex tool-bar-mode |
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi index 344e4831f36..e245cb81754 100644 --- a/doc/emacs/glossary.texi +++ b/doc/emacs/glossary.texi | |||
| @@ -1436,10 +1436,12 @@ particular appearance or behavior. For example, you might use a theme | |||
| 1436 | for your favorite set of faces (q.v.). | 1436 | for your favorite set of faces (q.v.). |
| 1437 | 1437 | ||
| 1438 | @item Tool Bar | 1438 | @item Tool Bar |
| 1439 | The tool bar is a line (sometimes multiple lines) of icons at the top | 1439 | The tool bar is a line (sometimes multiple lines) of buttons with icons |
| 1440 | of an Emacs frame. Clicking on one of these icons executes a command. | 1440 | at the top of an Emacs frame. Clicking on one of these buttons executes |
| 1441 | You can think of this as a graphical relative of the menu bar (q.v.). | 1441 | a command. You can think of this as a graphical relative of the menu |
| 1442 | @xref{Tool Bars}. | 1442 | bar (q.v.). @xref{Tool Bars}. There is also a window tool bar that |
| 1443 | behaves similarly, but is at the top of an Emacs window. @xref{Window | ||
| 1444 | Tool Bar}. | ||
| 1443 | 1445 | ||
| 1444 | @anchor{Glossary---Tooltips} | 1446 | @anchor{Glossary---Tooltips} |
| 1445 | @item Tooltips | 1447 | @item Tooltips |
diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi index 2776dc72a27..1321464014d 100644 --- a/doc/emacs/modes.texi +++ b/doc/emacs/modes.texi | |||
| @@ -296,6 +296,9 @@ but the tool bar is only displayed on graphical terminals. @xref{Tool | |||
| 296 | Bars}. | 296 | Bars}. |
| 297 | 297 | ||
| 298 | @item | 298 | @item |
| 299 | Window Tool Bar mode gives windows a tool bar. @xref{Window Tool Bar}. | ||
| 300 | |||
| 301 | @item | ||
| 299 | Tab Bar mode gives each frame a tab bar. @xref{Tab Bars}. | 302 | Tab Bar mode gives each frame a tab bar. @xref{Tab Bars}. |
| 300 | 303 | ||
| 301 | @item | 304 | @item |
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index ad2225b5922..80394e0e571 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi | |||
| @@ -22,6 +22,7 @@ one frame. | |||
| 22 | * Displaying Buffers:: How Emacs picks a window for displaying a buffer. | 22 | * Displaying Buffers:: How Emacs picks a window for displaying a buffer. |
| 23 | * Window Convenience:: Convenience functions for window handling. | 23 | * Window Convenience:: Convenience functions for window handling. |
| 24 | * Tab Line:: Window tab line. | 24 | * Tab Line:: Window tab line. |
| 25 | * Window Tool Bar:: A tool bar that is attached to windows. | ||
| 25 | @end menu | 26 | @end menu |
| 26 | 27 | ||
| 27 | @node Basic Window | 28 | @node Basic Window |
| @@ -689,3 +690,45 @@ Whereas tabs on the Tab Bar at the top of each frame are used to | |||
| 689 | switch between window configurations containing several windows with buffers, | 690 | switch between window configurations containing several windows with buffers, |
| 690 | tabs on the Tab Line at the top of each window are used to switch | 691 | tabs on the Tab Line at the top of each window are used to switch |
| 691 | between buffers in the window. | 692 | between buffers in the window. |
| 693 | |||
| 694 | Also note that the tab line displays in the same space as the window | ||
| 695 | tool bar, so only one of these can be display at a time unless you | ||
| 696 | customize the value of @code{tab-line-format} in Lisp. In this case, | ||
| 697 | add @code{(:eval (tab-line-format))} to @code{tab-line-format}. | ||
| 698 | @xref{Mode Line Format,,, elisp, The Emacs Lisp Reference Manual}. | ||
| 699 | |||
| 700 | |||
| 701 | @node Window Tool Bar | ||
| 702 | @section Window Tool Bar | ||
| 703 | |||
| 704 | @cindex window tool bar | ||
| 705 | @cindex mode, window tool bar | ||
| 706 | @cindex tool bar, attached to window | ||
| 707 | |||
| 708 | @findex global-window-tool-bar-mode | ||
| 709 | The command @code{global-window-tool-bar-mode} toggles the display of | ||
| 710 | a tool bar at the top of each window. When enabled, multiple windows | ||
| 711 | can display their own tool bar simultaneously. To conserve space, a | ||
| 712 | window tool bar is hidden if there are no buttons to show, i.e. if | ||
| 713 | @code{tool-bar-map} is @code{nil}. | ||
| 714 | |||
| 715 | @findex window-tool-bar-mode | ||
| 716 | If you want to toggle the display of a window tool bar for only some | ||
| 717 | buffers, run the command @code{window-tool-bar-mode} in those buffers. | ||
| 718 | This is useful to put in a mode hook. For example, if you want the window | ||
| 719 | tool bar to appear only for buffers that do not represent files and have | ||
| 720 | a custom tool bar, you could add the following code to your init file | ||
| 721 | (@pxref{Init File}): | ||
| 722 | |||
| 723 | @example | ||
| 724 | (add-hook 'special-mode-hook 'window-tool-bar-mode) | ||
| 725 | @end example | ||
| 726 | |||
| 727 | Emacs can also display a single tool bar at the top of frames | ||
| 728 | (@pxref{Tool Bars}). | ||
| 729 | |||
| 730 | Note that the window tool bar displays in the same space as the tab | ||
| 731 | line, so only one of these can be display at a time unless you customize | ||
| 732 | the value of @code{tab-line-format} in Lisp. In this case, add | ||
| 733 | @code{(:eval (window-tool-bar-string))} to @code{tab-line-format}. | ||
| 734 | @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 @@ Mode Line Format | |||
| 925 | * %-Constructs:: Putting information into a mode line. | 925 | * %-Constructs:: Putting information into a mode line. |
| 926 | * Properties in Mode:: Using text properties in the mode line. | 926 | * Properties in Mode:: Using text properties in the mode line. |
| 927 | * Header Lines:: Like a mode line, but at the top. | 927 | * Header Lines:: Like a mode line, but at the top. |
| 928 | * Tab Lines:: A line that is above the header line. | ||
| 928 | * Emulating Mode Line:: Formatting text as the mode line would. | 929 | * Emulating Mode Line:: Formatting text as the mode line would. |
| 929 | 930 | ||
| 930 | Font Lock Mode | 931 | Font Lock Mode |
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index cf67b319924..f3d4f5347b3 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi | |||
| @@ -2074,14 +2074,14 @@ their previous values/states (using the companion function | |||
| 2074 | line at the bottom, which displays status information about the buffer | 2074 | line at the bottom, which displays status information about the buffer |
| 2075 | displayed in the window. The mode line contains information about the | 2075 | displayed in the window. The mode line contains information about the |
| 2076 | buffer, such as its name, associated file, depth of recursive editing, | 2076 | buffer, such as its name, associated file, depth of recursive editing, |
| 2077 | and major and minor modes. A window can also have a @dfn{header | 2077 | and major and minor modes. A window can also have a @dfn{header line} |
| 2078 | line}, which is much like the mode line but appears at the top of the | 2078 | and a @dfn{tab line}, which are much like the mode line but they appear |
| 2079 | window. | 2079 | at the top of the window. |
| 2080 | 2080 | ||
| 2081 | This section describes how to control the contents of the mode line | 2081 | This section describes how to control the contents of the mode line, |
| 2082 | and header line. We include it in this chapter because much of the | 2082 | header line, and tab line. We include it in this chapter because much |
| 2083 | information displayed in the mode line relates to the enabled major and | 2083 | of the information displayed in the mode line relates to the enabled |
| 2084 | minor modes. | 2084 | major and minor modes. |
| 2085 | 2085 | ||
| 2086 | @menu | 2086 | @menu |
| 2087 | * Base: Mode Line Basics. Basic ideas of mode line control. | 2087 | * Base: Mode Line Basics. Basic ideas of mode line control. |
| @@ -2091,6 +2091,7 @@ minor modes. | |||
| 2091 | * %-Constructs:: Putting information into a mode line. | 2091 | * %-Constructs:: Putting information into a mode line. |
| 2092 | * Properties in Mode:: Using text properties in the mode line. | 2092 | * Properties in Mode:: Using text properties in the mode line. |
| 2093 | * Header Lines:: Like a mode line, but at the top. | 2093 | * Header Lines:: Like a mode line, but at the top. |
| 2094 | * Tab Lines:: A line that is above the header line. | ||
| 2094 | * Emulating Mode Line:: Formatting text as the mode line would. | 2095 | * Emulating Mode Line:: Formatting text as the mode line would. |
| 2095 | @end menu | 2096 | @end menu |
| 2096 | 2097 | ||
| @@ -2101,11 +2102,13 @@ minor modes. | |||
| 2101 | variable @code{mode-line-format} (@pxref{Mode Line Top}). This variable | 2102 | variable @code{mode-line-format} (@pxref{Mode Line Top}). This variable |
| 2102 | holds a @dfn{mode line construct}: a template that controls what is | 2103 | holds a @dfn{mode line construct}: a template that controls what is |
| 2103 | displayed on the buffer's mode line. The value of | 2104 | displayed on the buffer's mode line. The value of |
| 2104 | @code{header-line-format} specifies the buffer's header line in the same | 2105 | @code{header-line-format} and @code{tab-line-format} specifies the |
| 2105 | way. All windows for the same buffer use the same | 2106 | buffer's header line and tab line in the same way. All windows for the |
| 2106 | @code{mode-line-format} and @code{header-line-format} unless a | 2107 | same buffer use the same @code{mode-line-format}, |
| 2107 | @code{mode-line-format} or @code{header-line-format} parameter has been | 2108 | @code{header-line-format}, and @code{tab-line-format} unless a |
| 2108 | specified for that window (@pxref{Window Parameters}). | 2109 | @code{mode-line-format}, @code{header-line-format}, or |
| 2110 | @code{tab-line-format} parameter has been specified for that window | ||
| 2111 | (@pxref{Window Parameters}). | ||
| 2109 | 2112 | ||
| 2110 | For efficiency, Emacs does not continuously recompute each window's | 2113 | For efficiency, Emacs does not continuously recompute each window's |
| 2111 | mode line and header line. It does so when circumstances appear to call | 2114 | mode line and header line. It does so when circumstances appear to call |
| @@ -2167,8 +2170,8 @@ buffers. | |||
| 2167 | @dfn{mode line construct}, made up of lists, strings, symbols, and | 2170 | @dfn{mode line construct}, made up of lists, strings, symbols, and |
| 2168 | numbers kept in buffer-local variables. Each data type has a specific | 2171 | numbers kept in buffer-local variables. Each data type has a specific |
| 2169 | meaning for the mode line appearance, as described below. The same data | 2172 | meaning for the mode line appearance, as described below. The same data |
| 2170 | structure is used for constructing frame titles (@pxref{Frame Titles}) | 2173 | structure is used for constructing frame titles (@pxref{Frame Titles}), |
| 2171 | and header lines (@pxref{Header Lines}). | 2174 | header lines (@pxref{Header Lines}), and tab lines (@pxref{Tab Lines}). |
| 2172 | 2175 | ||
| 2173 | A mode line construct may be as simple as a fixed string of text, | 2176 | A mode line construct may be as simple as a fixed string of text, |
| 2174 | but it usually specifies how to combine fixed strings with variables' | 2177 | but it usually specifies how to combine fixed strings with variables' |
| @@ -2816,6 +2819,31 @@ window that is two lines tall cannot display both a mode line and a | |||
| 2816 | header line at once; if it has a mode line, then it does not display a | 2819 | header line at once; if it has a mode line, then it does not display a |
| 2817 | header line. | 2820 | header line. |
| 2818 | 2821 | ||
| 2822 | @node Tab Lines | ||
| 2823 | @subsection Window Tab Lines | ||
| 2824 | @cindex tab line (of a window) | ||
| 2825 | @cindex window tab line | ||
| 2826 | |||
| 2827 | A window can have a @dfn{tab line} at the top. If both the tab line | ||
| 2828 | and header line are visible, the tab line appears above the header line. | ||
| 2829 | The tab line feature is controlled like the mode line feature, except | ||
| 2830 | that it's controlled by @code{tab-line-format}. Unlike the mode line, | ||
| 2831 | the tab line is only expected to be used to display a list of tabs | ||
| 2832 | (@pxref{Tab Line,,, emacs, The GNU Emacs Manual}) or the window | ||
| 2833 | tool bar (@pxref{Window Tool Bar,,, emacs, The GNU Emacs Manual}): | ||
| 2834 | |||
| 2835 | @defvar tab-line-format | ||
| 2836 | This variable, local in every buffer, specifies how to display the tab | ||
| 2837 | line, for windows displaying the buffer. The format of the value is the | ||
| 2838 | same as for @code{mode-line-format} (@pxref{Mode Line Data}). It is | ||
| 2839 | normally @code{nil}, so that ordinary buffers have no tab line. | ||
| 2840 | @end defvar | ||
| 2841 | |||
| 2842 | @defun window-tab-line-height &optional window | ||
| 2843 | This function returns the height in pixels of @var{window}'s tab line. | ||
| 2844 | @var{window} must be a live window, and defaults to the selected window. | ||
| 2845 | @end defun | ||
| 2846 | |||
| 2819 | @node Emulating Mode Line | 2847 | @node Emulating Mode Line |
| 2820 | @subsection Emulating Mode Line Formatting | 2848 | @subsection Emulating Mode Line Formatting |
| 2821 | 2849 | ||
| @@ -265,6 +265,11 @@ When this minor mode is enabled, buttons representing modifier keys | |||
| 265 | are displayed along the tool bar. | 265 | are displayed along the tool bar. |
| 266 | 266 | ||
| 267 | +++ | 267 | +++ |
| 268 | ** New user option 'tool-bar-always-show-default'. | ||
| 269 | When non-nil, the tool bar at the top of a frame does not show buffer | ||
| 270 | local customization of the tool bar. The default value is nil. | ||
| 271 | |||
| 272 | +++ | ||
| 268 | ** "d" in the mode line now indicates that the window is dedicated. | 273 | ** "d" in the mode line now indicates that the window is dedicated. |
| 269 | Windows have always been able to be dedicated to a specific buffer; | 274 | Windows have always been able to be dedicated to a specific buffer; |
| 270 | see 'window-dedicated-p'. Now the mode line indicates the dedicated | 275 | see 'window-dedicated-p'. Now the mode line indicates the dedicated |
| @@ -2017,6 +2022,13 @@ To revert to the previous behavior, set the (also new) variable | |||
| 2017 | 'async-shell-command-mode' to 'shell-mode'. Any hooks or mode-specific | 2022 | 'async-shell-command-mode' to 'shell-mode'. Any hooks or mode-specific |
| 2018 | variables used should be adapted appropriately. | 2023 | variables used should be adapted appropriately. |
| 2019 | 2024 | ||
| 2025 | +++ | ||
| 2026 | ** New package Window-Tool-Bar. | ||
| 2027 | This provides a new minor mode, 'window-tool-bar-mode'. When this minor | ||
| 2028 | mode is enabled, a tool bar is displayed at the top of a window. To | ||
| 2029 | conserve space, no tool bar is shown if 'tool-bar-map' is nil. The | ||
| 2030 | global minor mode 'global-window-tool-bar-mode' enables this minor mode | ||
| 2031 | in all buffers. | ||
| 2020 | 2032 | ||
| 2021 | * Incompatible Lisp Changes in Emacs 30.1 | 2033 | * Incompatible Lisp Changes in Emacs 30.1 |
| 2022 | 2034 | ||
diff --git a/lisp/window-tool-bar.el b/lisp/window-tool-bar.el index a9d10650b98..63484da3255 100644 --- a/lisp/window-tool-bar.el +++ b/lisp/window-tool-bar.el | |||
| @@ -4,9 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | ;; Author: Jared Finder <jared@finder.org> | 5 | ;; Author: Jared Finder <jared@finder.org> |
| 6 | ;; Created: Nov 21, 2023 | 6 | ;; Created: Nov 21, 2023 |
| 7 | ;; Version: 0.2 | 7 | ;; Version: 0.2.1 |
| 8 | ;; Keywords: mouse | 8 | ;; Keywords: mouse |
| 9 | ;; Package-Requires: ((emacs "29.1")) | 9 | ;; Package-Requires: ((emacs "27.1") (compat "29.1")) |
| 10 | 10 | ||
| 11 | ;; This is a GNU ELPA :core package. Avoid adding functionality that | 11 | ;; This is a GNU ELPA :core package. Avoid adding functionality that |
| 12 | ;; is not available in the version of Emacs recorded above or any of | 12 | ;; is not available in the version of Emacs recorded above or any of |
| @@ -35,11 +35,11 @@ | |||
| 35 | ;; generally have sensible tool bars, for example: *info*, *help*, and | 35 | ;; generally have sensible tool bars, for example: *info*, *help*, and |
| 36 | ;; *eww* have them. | 36 | ;; *eww* have them. |
| 37 | ;; | 37 | ;; |
| 38 | ;; It does this while being mindful of screen real estate. Most modes | 38 | ;; It does this while being mindful of screen real estate. If |
| 39 | ;; do not provide a custom tool bar, and this package does not show the | 39 | ;; `tool-bar-map' is nil, then this package will not take up any space |
| 40 | ;; default tool bar. This means that for most buffers there will be no | 40 | ;; for an empty tool bar. Most modes do not define a custom tool bar, |
| 41 | ;; space taken up. Furthermore, you can put this tool bar in the mode | 41 | ;; so calling (setq tool-bar-map nil) in your init file will make most |
| 42 | ;; line or tab line if you want to share it with existing content. | 42 | ;; buffers not take up space for a tool bar. |
| 43 | ;; | 43 | ;; |
| 44 | ;; To get the default behavior, run (global-window-tool-bar-mode 1) or | 44 | ;; To get the default behavior, run (global-window-tool-bar-mode 1) or |
| 45 | ;; enable via M-x customize-group RET window-tool-bar RET. This uses | 45 | ;; enable via M-x customize-group RET window-tool-bar RET. This uses |
| @@ -48,6 +48,9 @@ | |||
| 48 | ;; If you want to share space with an existing tab line, mode line, or | 48 | ;; If you want to share space with an existing tab line, mode line, or |
| 49 | ;; header line, add (:eval (window-tool-bar-string)) to | 49 | ;; header line, add (:eval (window-tool-bar-string)) to |
| 50 | ;; `tab-line-format', `mode-line-format', or `header-line-format'. | 50 | ;; `tab-line-format', `mode-line-format', or `header-line-format'. |
| 51 | ;; | ||
| 52 | ;; For additional documentation, see info node `(emacs)Window Tool | ||
| 53 | ;; Bar' | ||
| 51 | 54 | ||
| 52 | ;;; Known issues: | 55 | ;;; Known issues: |
| 53 | ;; | 56 | ;; |
| @@ -92,6 +95,7 @@ | |||
| 92 | 95 | ||
| 93 | ;;; Code: | 96 | ;;; Code: |
| 94 | 97 | ||
| 98 | (require 'compat) | ||
| 95 | (require 'mwheel) | 99 | (require 'mwheel) |
| 96 | (require 'tab-line) | 100 | (require 'tab-line) |
| 97 | (require 'tool-bar) | 101 | (require 'tool-bar) |
| @@ -271,7 +275,7 @@ This is for when you want more customizations than | |||
| 271 | (defun window-tool-bar--keymap-entry-to-string (menu-item) | 275 | (defun window-tool-bar--keymap-entry-to-string (menu-item) |
| 272 | "Convert MENU-ITEM into a (propertized) string representation. | 276 | "Convert MENU-ITEM into a (propertized) string representation. |
| 273 | 277 | ||
| 274 | MENU-ITEM is a menu item to convert. See info node (elisp)Tool Bar." | 278 | MENU-ITEM is a menu item to convert. See info node `(elisp)Tool Bar'." |
| 275 | (pcase-exhaustive menu-item | 279 | (pcase-exhaustive menu-item |
| 276 | ;; Separators | 280 | ;; Separators |
| 277 | ((or `(,_ "--") | 281 | ((or `(,_ "--") |
| @@ -394,8 +398,7 @@ enclosed in a `progn' form. ELSE-FORMS may be empty." | |||
| 394 | "Toggle display of the tool bar in the tab line of the current buffer." | 398 | "Toggle display of the tool bar in the tab line of the current buffer." |
| 395 | :global nil | 399 | :global nil |
| 396 | (let ((should-display (and window-tool-bar-mode | 400 | (let ((should-display (and window-tool-bar-mode |
| 397 | (not (eq tool-bar-map | 401 | tool-bar-map)) |
| 398 | (default-value 'tool-bar-map))))) | ||
| 399 | (default-value '(:eval (window-tool-bar-string)))) | 402 | (default-value '(:eval (window-tool-bar-string)))) |
| 400 | 403 | ||
| 401 | ;; Preserve existing tab-line set outside of this mode | 404 | ;; Preserve existing tab-line set outside of this mode |
| @@ -465,6 +468,10 @@ capabilities." | |||
| 465 | :group 'window-tool-bar) | 468 | :group 'window-tool-bar) |
| 466 | 469 | ||
| 467 | ;;; Workaround for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68334. | 470 | ;;; Workaround for https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68334. |
| 471 | |||
| 472 | ;; This special variable is added in Emacs 30.1. | ||
| 473 | (defvar tool-bar-always-show-default) | ||
| 474 | |||
| 468 | (defun window-tool-bar--get-keymap () | 475 | (defun window-tool-bar--get-keymap () |
| 469 | "Return the tool bar keymap." | 476 | "Return the tool bar keymap." |
| 470 | (let ((tool-bar-always-show-default nil)) | 477 | (let ((tool-bar-always-show-default nil)) |