diff options
| author | Juri Linkov | 2019-10-08 01:28:42 +0300 |
|---|---|---|
| committer | Juri Linkov | 2019-10-08 01:28:42 +0300 |
| commit | 3f9ad4e725788dff5eaafc4678286c9386302a17 (patch) | |
| tree | 3d1c6d2e0014bf5c85fe55cb66ae90d64e072c1d | |
| parent | 9839466b231b6384055b9b137405730876413cbe (diff) | |
| download | emacs-3f9ad4e725788dff5eaafc4678286c9386302a17.tar.gz emacs-3f9ad4e725788dff5eaafc4678286c9386302a17.zip | |
* 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.
| -rw-r--r-- | lisp/tab-bar.el | 24 |
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. |
| 254 | Function gets no arguments. | 254 | Function gets no arguments. |
| 255 | By default, use function `tab-bar-tab-name'.") | 255 | The choice is between displaying only the name of the current buffer |
| 256 | in the tab name (default), or displaying the names of all buffers | ||
| 257 | from 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. | ||
| 270 | Also 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) |