Commit bc8089a3 authored by James N. V. Cash's avatar James N. V. Cash Committed by Juri Linkov

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
parent 519e64f9
Pipeline #5967 failed with stage
in 10 seconds
......@@ -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'.
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment