emacs-diffs
[Top][All Lists]
Advanced

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

master a4e789c 2/2: * lisp/tab-bar.el: Optimize data usage for nil tab-b


From: Juri Linkov
Subject: master a4e789c 2/2: * lisp/tab-bar.el: Optimize data usage for nil tab-bar-history-mode.
Date: Thu, 18 Nov 2021 12:29:39 -0500 (EST)

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

    * lisp/tab-bar.el: Optimize data usage for nil tab-bar-history-mode.
    
    * lisp/tab-bar.el (tab-bar--tab): Add wc-history-back and
    wc-history-forward only when tab-bar-history-mode is non-nil.
    (tab-bar-select-tab): Use wc-history-back and
    wc-history-forward only when tab-bar-history-mode is non-nil.
    (tab-bar-new-tab-to): Reset tab-bar-history-back and
    tab-bar-history-forward to nil.
---
 lisp/tab-bar.el | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 9e554f7..c2bf302 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -980,10 +980,11 @@ on the tab bar instead."
       (wc-point . ,(point-marker))
       (wc-bl . ,bl)
       (wc-bbl . ,bbl)
-      (wc-history-back . ,(gethash (or frame (selected-frame))
-                                   tab-bar-history-back))
-      (wc-history-forward . ,(gethash (or frame (selected-frame))
-                                      tab-bar-history-forward))
+      ,@(when tab-bar-history-mode
+          `((wc-history-back . ,(gethash (or frame (selected-frame))
+                                         tab-bar-history-back))
+            (wc-history-forward . ,(gethash (or frame (selected-frame))
+                                            tab-bar-history-forward))))
       ;; Copy other possible parameters
       ,@(mapcan (lambda (param)
                   (unless (memq (car param)
@@ -1124,19 +1125,21 @@ Negative TAB-NUMBER counts tabs from the end of the tab 
bar."
             (when wc-bl  (set-frame-parameter nil 'buffer-list wc-bl))
             (when wc-bbl (set-frame-parameter nil 'buried-buffer-list wc-bbl))
 
-            (puthash (selected-frame)
-                     (and (window-configuration-p (alist-get 'wc (car 
wc-history-back)))
-                          wc-history-back)
-                     tab-bar-history-back)
-            (puthash (selected-frame)
-                     (and (window-configuration-p (alist-get 'wc (car 
wc-history-forward)))
-                          wc-history-forward)
-                     tab-bar-history-forward)))
+            (when tab-bar-history-mode
+              (puthash (selected-frame)
+                       (and (window-configuration-p (alist-get 'wc (car 
wc-history-back)))
+                            wc-history-back)
+                       tab-bar-history-back)
+              (puthash (selected-frame)
+                       (and (window-configuration-p (alist-get 'wc (car 
wc-history-forward)))
+                            wc-history-forward)
+                       tab-bar-history-forward))))
 
          (ws
           (window-state-put ws nil 'safe)))
 
-        (setq tab-bar-history-omit t)
+        (when tab-bar-history-mode
+          (setq tab-bar-history-omit t))
 
         (when from-index
           (setf (nth from-index tabs) from-tab))
@@ -1386,6 +1389,11 @@ After the tab is created, the hooks in
         ;; `pushnew' handles the head of tabs but not frame-parameter
         (tab-bar-tabs-set tabs))
 
+      (when tab-bar-history-mode
+        (puthash (selected-frame) nil tab-bar-history-back)
+        (puthash (selected-frame) nil tab-bar-history-forward)
+        (setq tab-bar-history-omit t))
+
       (run-hook-with-args 'tab-bar-tab-post-open-functions
                           (nth to-index tabs)))
 



reply via email to

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