summaryrefslogtreecommitdiff
path: root/lisp/tab-bar.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2021-11-18 19:27:46 +0200
committerJuri Linkov <juri@linkov.net>2021-11-18 19:28:32 +0200
commita4e789c2e32dd16898529ece30bd2a90cef40c10 (patch)
tree8f8302a9d44668baea93639d26cd4c5b71c8ef6e /lisp/tab-bar.el
parent5c8c3d59ead75df199f31b892f17f8a0a101a62c (diff)
downloademacs-a4e789c2e32dd16898529ece30bd2a90cef40c10.tar.gz
* 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.
Diffstat (limited to 'lisp/tab-bar.el')
-rw-r--r--lisp/tab-bar.el34
1 files changed, 21 insertions, 13 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 9e554f718f3..c2bf3021b08 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)))