1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-26 15:21:51 -08:00

* 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.
This commit is contained in:
Juri Linkov 2021-11-18 19:27:46 +02:00
parent 5c8c3d59ea
commit a4e789c2e3

View file

@ -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)))