summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2021-01-07 20:08:44 +0200
committerJuri Linkov <juri@linkov.net>2021-01-07 20:08:44 +0200
commitcd56406b621bebff484a2978662c98f7689540bf (patch)
tree3a03bb005362792f4c0a1b7e4c08b62383424443
parentc0ca9359179071cc634adc0efd4523907b1e2e74 (diff)
downloademacs-cd56406b621bebff484a2978662c98f7689540bf.tar.gz
* lisp/tab-bar.el: Improve tab-bar-show (bug#45556)
* lisp/tab-bar.el (tab-bar-show): Change :set lambda to update all frames. Improve docstring.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/tab-bar.el27
2 files changed, 22 insertions, 9 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 14d6b45c929..eaaf9bfb0ef 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -412,8 +412,8 @@ value of 'tab-bar-show'.
---
*** New command 'toggle-frame-tab-bar'.
-It can be used to enable/disable the tab bar individually
-on each frame independently from the state of `tab-bar-mode'.
+It can be used to enable/disable the tab bar individually on each frame
+independently from the value of 'tab-bar-mode' and 'tab-bar-show'.
---
*** New user option 'tab-bar-tab-name-format-function'.
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 5a95e5975de..7e556550daa 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -187,9 +187,9 @@ on a console which has no window system but does have a mouse."
;; Clicking anywhere outside existing tabs will add a new tab
(tab-bar-new-tab)))))
-;; Used in the Show/Hide menu, to have the toggle reflect the current frame.
(defun toggle-tab-bar-mode-from-frame (&optional arg)
"Toggle tab bar on or off, based on the status of the current frame.
+Used in the Show/Hide menu, to have the toggle reflect the current frame.
See `tab-bar-mode' for more information."
(interactive (list (or current-prefix-arg 'toggle)))
(if (eq arg 'toggle)
@@ -236,18 +236,31 @@ If the value is `1', then hide the tab bar when it has only one tab,
and show it again once more tabs are created.
If nil, always keep the tab bar hidden. In this case it's still
possible to use persistent named window configurations by relying on
-keyboard commands `tab-new', `tab-close', `tab-next', `tab-switcher', etc."
+keyboard commands `tab-new', `tab-close', `tab-next', `tab-switcher', etc.
+
+Setting this variable directly does not take effect; please customize
+it (see the info node `Easy Customization'), then it will automatically
+update the tab bar on all frames according to the new value.
+
+To enable or disable the tab bar individually on each frame,
+you can use the command `toggle-frame-tab-bar'."
:type '(choice (const :tag "Always" t)
(const :tag "When more than one tab" 1)
(const :tag "Never" nil))
:initialize 'custom-initialize-default
:set (lambda (sym val)
(set-default sym val)
- (tab-bar-mode
- (if (or (eq val t)
- (and (natnump val)
- (> (length (funcall tab-bar-tabs-function)) val)))
- 1 -1)))
+ ;; Preload button images
+ (tab-bar-mode 1)
+ ;; Then handle each frame individually
+ (dolist (frame (frame-list))
+ (set-frame-parameter
+ frame 'tab-bar-lines
+ (if (or (eq val t)
+ (and (natnump val)
+ (> (length (funcall tab-bar-tabs-function frame))
+ val)))
+ 1 0))))
:group 'tab-bar
:version "27.1")