aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJared Finder2024-06-08 17:23:58 -0700
committerEli Zaretskii2024-06-09 15:21:34 +0300
commita5c0d682b10fa60925641c6abc3a5dbee024fa46 (patch)
treed8ad62800a6d19bc37b5dc03f3ca87d4df930d3b /lisp
parent7f8ded2a85d551c6e3303eaca1697bbd7b9427ef (diff)
downloademacs-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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/window-tool-bar.el27
1 files changed, 17 insertions, 10 deletions
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
274MENU-ITEM is a menu item to convert. See info node (elisp)Tool Bar." 278MENU-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))