[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 3f9ad4e: * lisp/tab-bar.el (tab-bar-tab-name-functi
From: |
Juri Linkov |
Subject: |
[Emacs-diffs] master 3f9ad4e: * lisp/tab-bar.el (tab-bar-tab-name-function): Turn defvar into defcustom. |
Date: |
Mon, 7 Oct 2019 18:28:51 -0400 (EDT) |
branch: master
commit 3f9ad4e725788dff5eaafc4678286c9386302a17
Author: Juri Linkov <address@hidden>
Commit: Juri Linkov <address@hidden>
* lisp/tab-bar.el (tab-bar-tab-name-function): Turn defvar into defcustom.
(tab-bar-tab-name-all-windows): Rename from tab-bar-tab-name.
(tab-bar-tab-name-selected-window): New function used by default.
---
lisp/tab-bar.el | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index 1c1acaa..91bc589 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'."
(defvar tab-bar-separator nil)
-(defvar tab-bar-tab-name-function #'tab-bar-tab-name
+(defcustom tab-bar-tab-name-function #'tab-bar-tab-name-selected-window
"Function to get a tab name.
Function gets no arguments.
-By default, use function `tab-bar-tab-name'.")
+The choice is between displaying only the name of the current buffer
+in the tab name (default), or displaying the names of all buffers
+from all windows in the window configuration."
+ :type '(choice (const :tag "Selected window buffer"
tab-bar-tab-name-selected-window)
+ (const :tag "All window buffers" tab-bar-tab-name-all-windows)
+ (function :tag "Function"))
+ :initialize 'custom-initialize-default
+ :set (lambda (sym val)
+ (set-default sym val)
+ (force-mode-line-update))
+ :group 'tab-bar
+ :version "27.1")
+
+(defun tab-bar-tab-name-selected-window ()
+ "Generate tab name from the buffer of the selected window.
+Also add the number of windows in the window configuration."
+ (format "%s (%d)" (buffer-name) (length (window-list-1 nil 'nomini))))
-(defun tab-bar-tab-name ()
- "Generate tab name in the context of the selected frame."
+(defun tab-bar-tab-name-all-windows ()
+ "Generate tab name from buffers of all windows."
(mapconcat #'buffer-name
(delete-dups (mapcar #'window-buffer
(window-list-1 (frame-first-window)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 3f9ad4e: * lisp/tab-bar.el (tab-bar-tab-name-function): Turn defvar into defcustom.,
Juri Linkov <=