aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames N. V. Cash2020-06-30 02:45:15 +0300
committerJuri Linkov2020-06-30 02:45:15 +0300
commitbc8089a3fa11161428c51439fd3b26fd6583345d (patch)
tree0ef9822db66e6341e833d1f4dceece0ad78e7c35
parent519e64f98140b984e10a9567017c7e5c4a81ff89 (diff)
downloademacs-bc8089a3fa11161428c51439fd3b26fd6583345d.tar.gz
emacs-bc8089a3fa11161428c51439fd3b26fd6583345d.zip
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/NEWS4
-rw-r--r--lisp/tab-bar.el29
2 files changed, 21 insertions, 12 deletions
diff --git a/etc/NEWS b/etc/NEWS
index d58a61be21f..ddc0999c9e8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -127,6 +127,10 @@ setting the variable 'auto-save-visited-mode' buffer-locally to nil.
127 127
128*** The key prefix 'C-x t t' displays next command buffer in a new tab. 128*** The key prefix 'C-x t t' displays next command buffer in a new tab.
129 129
130*** The tab bar is frame-local when 'tab-bar-show' is a number.
131Show/hide the tab bar independently for each frame, according to the
132value of 'tab-bar-show'.
133
130** New bindings in occur-mode, 'next-error-no-select' bound to 'n' and 134** New bindings in occur-mode, 'next-error-no-select' bound to 'n' and
131'previous-error-no-select' bound to 'p'. 135'previous-error-no-select' bound to 'p'.
132 136
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
799 (run-hook-with-args 'tab-bar-tab-post-open-functions 799 (run-hook-with-args 'tab-bar-tab-post-open-functions
800 (nth to-index tabs))) 800 (nth to-index tabs)))
801 801
802 (when (and (not tab-bar-mode) 802 (cond
803 (or (eq tab-bar-show t) 803 (tab-bar-mode)
804 (and (natnump tab-bar-show) 804 ((eq tab-bar-show t)
805 (> (length tabs) tab-bar-show))))
806 (tab-bar-mode 1)) 805 (tab-bar-mode 1))
806 ((and (natnump tab-bar-show)
807 (> (length (funcall tab-bar-tabs-function)) tab-bar-show)
808 (zerop (frame-parameter nil 'tab-bar-lines)))
809 (set-frame-parameter nil 'tab-bar-lines 1)))
807 810
808 (force-mode-line-update) 811 (force-mode-line-update)
809 (unless tab-bar-mode 812 (unless tab-bar-mode
@@ -936,10 +939,11 @@ for the last tab on a frame is determined by
936 tab-bar-closed-tabs) 939 tab-bar-closed-tabs)
937 (set-frame-parameter nil 'tabs (delq close-tab tabs))) 940 (set-frame-parameter nil 'tabs (delq close-tab tabs)))
938 941
939 (when (and tab-bar-mode 942 (when (and (not (zerop (frame-parameter nil 'tab-bar-lines)))
940 (and (natnump tab-bar-show) 943 (natnump tab-bar-show)
941 (<= (length tabs) tab-bar-show))) 944 (<= (length (funcall tab-bar-tabs-function))
942 (tab-bar-mode -1)) 945 tab-bar-show))
946 (set-frame-parameter nil 'tab-bar-lines 0))
943 947
944 (force-mode-line-update) 948 (force-mode-line-update)
945 (unless tab-bar-mode 949 (unless tab-bar-mode
@@ -975,10 +979,11 @@ for the last tab on a frame is determined by
975 (run-hook-with-args 'tab-bar-tab-pre-close-functions (nth index tabs) nil))) 979 (run-hook-with-args 'tab-bar-tab-pre-close-functions (nth index tabs) nil)))
976 (set-frame-parameter nil 'tabs (list (nth current-index tabs))) 980 (set-frame-parameter nil 'tabs (list (nth current-index tabs)))
977 981
978 (when (and tab-bar-mode 982 (when (and (not (zerop (frame-parameter nil 'tab-bar-lines)))
979 (and (natnump tab-bar-show) 983 (natnump tab-bar-show)
980 (<= 1 tab-bar-show))) 984 (<= (length (funcall tab-bar-tabs-function))
981 (tab-bar-mode -1)) 985 tab-bar-show))
986 (set-frame-parameter nil 'tab-bar-lines 0))
982 987
983 (force-mode-line-update) 988 (force-mode-line-update)
984 (unless tab-bar-mode 989 (unless tab-bar-mode