aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/tab-bar.el24
1 files changed, 20 insertions, 4 deletions
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 1c1acaafa47..91bc589ae29 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -249,13 +249,29 @@ This helps to select the tab by its number using `tab-bar-select-tab'."
249(defvar tab-bar-separator nil) 249(defvar tab-bar-separator nil)
250 250
251 251
252(defvar tab-bar-tab-name-function #'tab-bar-tab-name 252(defcustom tab-bar-tab-name-function #'tab-bar-tab-name-selected-window
253 "Function to get a tab name. 253 "Function to get a tab name.
254Function gets no arguments. 254Function gets no arguments.
255By default, use function `tab-bar-tab-name'.") 255The choice is between displaying only the name of the current buffer
256in the tab name (default), or displaying the names of all buffers
257from all windows in the window configuration."
258 :type '(choice (const :tag "Selected window buffer" tab-bar-tab-name-selected-window)
259 (const :tag "All window buffers" tab-bar-tab-name-all-windows)
260 (function :tag "Function"))
261 :initialize 'custom-initialize-default
262 :set (lambda (sym val)
263 (set-default sym val)
264 (force-mode-line-update))
265 :group 'tab-bar
266 :version "27.1")
267
268(defun tab-bar-tab-name-selected-window ()
269 "Generate tab name from the buffer of the selected window.
270Also add the number of windows in the window configuration."
271 (format "%s (%d)" (buffer-name) (length (window-list-1 nil 'nomini))))
256 272
257(defun tab-bar-tab-name () 273(defun tab-bar-tab-name-all-windows ()
258 "Generate tab name in the context of the selected frame." 274 "Generate tab name from buffers of all windows."
259 (mapconcat #'buffer-name 275 (mapconcat #'buffer-name
260 (delete-dups (mapcar #'window-buffer 276 (delete-dups (mapcar #'window-buffer
261 (window-list-1 (frame-first-window) 277 (window-list-1 (frame-first-window)