emacs-diffs
[Top][All Lists]
Advanced

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

master cd56406: * lisp/tab-bar.el: Improve tab-bar-show (bug#45556)


From: Juri Linkov
Subject: master cd56406: * lisp/tab-bar.el: Improve tab-bar-show (bug#45556)
Date: Thu, 7 Jan 2021 13:09:06 -0500 (EST)

branch: master
commit cd56406b621bebff484a2978662c98f7689540bf
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * 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.
---
 etc/NEWS        |  4 ++--
 lisp/tab-bar.el | 27 ++++++++++++++++++++-------
 2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 14d6b45..eaaf9bf 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 5a95e59..7e55655 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")
 



reply via email to

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