diff options
| author | Juri Linkov | 2021-11-18 19:27:46 +0200 |
|---|---|---|
| committer | Juri Linkov | 2021-11-18 19:28:32 +0200 |
| commit | a4e789c2e32dd16898529ece30bd2a90cef40c10 (patch) | |
| tree | 8f8302a9d44668baea93639d26cd4c5b71c8ef6e | |
| parent | 5c8c3d59ead75df199f31b892f17f8a0a101a62c (diff) | |
| download | emacs-a4e789c2e32dd16898529ece30bd2a90cef40c10.tar.gz emacs-a4e789c2e32dd16898529ece30bd2a90cef40c10.zip | |
* 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.
| -rw-r--r-- | lisp/tab-bar.el | 34 |
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." | |||
| 980 | (wc-point . ,(point-marker)) | 980 | (wc-point . ,(point-marker)) |
| 981 | (wc-bl . ,bl) | 981 | (wc-bl . ,bl) |
| 982 | (wc-bbl . ,bbl) | 982 | (wc-bbl . ,bbl) |
| 983 | (wc-history-back . ,(gethash (or frame (selected-frame)) | 983 | ,@(when tab-bar-history-mode |
| 984 | tab-bar-history-back)) | 984 | `((wc-history-back . ,(gethash (or frame (selected-frame)) |
| 985 | (wc-history-forward . ,(gethash (or frame (selected-frame)) | 985 | tab-bar-history-back)) |
| 986 | tab-bar-history-forward)) | 986 | (wc-history-forward . ,(gethash (or frame (selected-frame)) |
| 987 | tab-bar-history-forward)))) | ||
| 987 | ;; Copy other possible parameters | 988 | ;; Copy other possible parameters |
| 988 | ,@(mapcan (lambda (param) | 989 | ,@(mapcan (lambda (param) |
| 989 | (unless (memq (car param) | 990 | (unless (memq (car param) |
| @@ -1124,19 +1125,21 @@ Negative TAB-NUMBER counts tabs from the end of the tab bar." | |||
| 1124 | (when wc-bl (set-frame-parameter nil 'buffer-list wc-bl)) | 1125 | (when wc-bl (set-frame-parameter nil 'buffer-list wc-bl)) |
| 1125 | (when wc-bbl (set-frame-parameter nil 'buried-buffer-list wc-bbl)) | 1126 | (when wc-bbl (set-frame-parameter nil 'buried-buffer-list wc-bbl)) |
| 1126 | 1127 | ||
| 1127 | (puthash (selected-frame) | 1128 | (when tab-bar-history-mode |
| 1128 | (and (window-configuration-p (alist-get 'wc (car wc-history-back))) | 1129 | (puthash (selected-frame) |
| 1129 | wc-history-back) | 1130 | (and (window-configuration-p (alist-get 'wc (car wc-history-back))) |
| 1130 | tab-bar-history-back) | 1131 | wc-history-back) |
| 1131 | (puthash (selected-frame) | 1132 | tab-bar-history-back) |
| 1132 | (and (window-configuration-p (alist-get 'wc (car wc-history-forward))) | 1133 | (puthash (selected-frame) |
| 1133 | wc-history-forward) | 1134 | (and (window-configuration-p (alist-get 'wc (car wc-history-forward))) |
| 1134 | tab-bar-history-forward))) | 1135 | wc-history-forward) |
| 1136 | tab-bar-history-forward)))) | ||
| 1135 | 1137 | ||
| 1136 | (ws | 1138 | (ws |
| 1137 | (window-state-put ws nil 'safe))) | 1139 | (window-state-put ws nil 'safe))) |
| 1138 | 1140 | ||
| 1139 | (setq tab-bar-history-omit t) | 1141 | (when tab-bar-history-mode |
| 1142 | (setq tab-bar-history-omit t)) | ||
| 1140 | 1143 | ||
| 1141 | (when from-index | 1144 | (when from-index |
| 1142 | (setf (nth from-index tabs) from-tab)) | 1145 | (setf (nth from-index tabs) from-tab)) |
| @@ -1386,6 +1389,11 @@ After the tab is created, the hooks in | |||
| 1386 | ;; `pushnew' handles the head of tabs but not frame-parameter | 1389 | ;; `pushnew' handles the head of tabs but not frame-parameter |
| 1387 | (tab-bar-tabs-set tabs)) | 1390 | (tab-bar-tabs-set tabs)) |
| 1388 | 1391 | ||
| 1392 | (when tab-bar-history-mode | ||
| 1393 | (puthash (selected-frame) nil tab-bar-history-back) | ||
| 1394 | (puthash (selected-frame) nil tab-bar-history-forward) | ||
| 1395 | (setq tab-bar-history-omit t)) | ||
| 1396 | |||
| 1389 | (run-hook-with-args 'tab-bar-tab-post-open-functions | 1397 | (run-hook-with-args 'tab-bar-tab-post-open-functions |
| 1390 | (nth to-index tabs))) | 1398 | (nth to-index tabs))) |
| 1391 | 1399 | ||