diff options
| author | James N. V. Cash <james.nvc@gmail.com> | 2020-06-30 02:45:15 +0300 |
|---|---|---|
| committer | Juri Linkov <juri@linkov.net> | 2020-06-30 02:45:15 +0300 |
| commit | bc8089a3fa11161428c51439fd3b26fd6583345d (patch) | |
| tree | 0ef9822db66e6341e833d1f4dceece0ad78e7c35 | |
| parent | 519e64f98140b984e10a9567017c7e5c4a81ff89 (diff) | |
| download | emacs-bc8089a3fa11161428c51439fd3b26fd6583345d.tar.gz | |
Subject: Frame-local tab-bar for numeric value of tab-bar-show (bug#42052)
* lisp/tab-bar.el (tab-bar-new-tab-to): Set frame parameter
tab-bar-lines to 1 when tab-bar-show is the same as number of tabs.
(tab-bar-close-tab, tab-bar-close-other-tabs): Set frame parameter
tab-bar-lines to 0 when tab-bar-show is the same as number of tabs.
Copyright-paperwork-exempt: yes
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/tab-bar.el | 29 |
2 files changed, 21 insertions, 12 deletions
@@ -127,6 +127,10 @@ setting the variable 'auto-save-visited-mode' buffer-locally to nil. *** The key prefix 'C-x t t' displays next command buffer in a new tab. +*** The tab bar is frame-local when 'tab-bar-show' is a number. +Show/hide the tab bar independently for each frame, according to the +value of 'tab-bar-show'. + ** New bindings in occur-mode, 'next-error-no-select' bound to 'n' and 'previous-error-no-select' bound to 'p'. diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el index 0a336e41658..04f4bca166c 100644 --- a/lisp/tab-bar.el +++ b/lisp/tab-bar.el @@ -799,11 +799,14 @@ After the tab is created, the hooks in (run-hook-with-args 'tab-bar-tab-post-open-functions (nth to-index tabs))) - (when (and (not tab-bar-mode) - (or (eq tab-bar-show t) - (and (natnump tab-bar-show) - (> (length tabs) tab-bar-show)))) + (cond + (tab-bar-mode) + ((eq tab-bar-show t) (tab-bar-mode 1)) + ((and (natnump tab-bar-show) + (> (length (funcall tab-bar-tabs-function)) tab-bar-show) + (zerop (frame-parameter nil 'tab-bar-lines))) + (set-frame-parameter nil 'tab-bar-lines 1))) (force-mode-line-update) (unless tab-bar-mode @@ -936,10 +939,11 @@ for the last tab on a frame is determined by tab-bar-closed-tabs) (set-frame-parameter nil 'tabs (delq close-tab tabs))) - (when (and tab-bar-mode - (and (natnump tab-bar-show) - (<= (length tabs) tab-bar-show))) - (tab-bar-mode -1)) + (when (and (not (zerop (frame-parameter nil 'tab-bar-lines))) + (natnump tab-bar-show) + (<= (length (funcall tab-bar-tabs-function)) + tab-bar-show)) + (set-frame-parameter nil 'tab-bar-lines 0)) (force-mode-line-update) (unless tab-bar-mode @@ -975,10 +979,11 @@ for the last tab on a frame is determined by (run-hook-with-args 'tab-bar-tab-pre-close-functions (nth index tabs) nil))) (set-frame-parameter nil 'tabs (list (nth current-index tabs))) - (when (and tab-bar-mode - (and (natnump tab-bar-show) - (<= 1 tab-bar-show))) - (tab-bar-mode -1)) + (when (and (not (zerop (frame-parameter nil 'tab-bar-lines))) + (natnump tab-bar-show) + (<= (length (funcall tab-bar-tabs-function)) + tab-bar-show)) + (set-frame-parameter nil 'tab-bar-lines 0)) (force-mode-line-update) (unless tab-bar-mode |
