about summary refs log tree commit diff stats
path: root/lisp/+tab-bar.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/+tab-bar.el')
-rw-r--r--lisp/+tab-bar.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/+tab-bar.el b/lisp/+tab-bar.el index 2a03121..1dc1f68 100644 --- a/lisp/+tab-bar.el +++ b/lisp/+tab-bar.el
@@ -21,6 +21,26 @@
21(defvar +tab-bar-show-original nil 21(defvar +tab-bar-show-original nil
22 "Original value of `tab-bar-show'.") 22 "Original value of `tab-bar-show'.")
23 23
24(defun +tab-bar-tab-name-truncated-left ()
25 "Generate the tab name from the buffer of the selected window.
26This is just like `tab-bar-tab-name-truncated', but truncates the
27name to the left."
28 (let* ((tab-name (buffer-name (window-buffer (minibuffer-selected-window))))
29 (ellipsis (cond
30 (tab-bar-tab-name-ellipsis)
31 ((char-displayable-p ?…) "…")
32 ("...")))
33 (l-ell (length ellipsis))
34 (l-name (length tab-name)))
35 (if (< (length tab-name) tab-bar-tab-name-truncated-max)
36 tab-name
37 (propertize (concat
38 (when (> (+ l-name l-ell) tab-bar-tab-name-truncated-max)
39 ellipsis)
40 (truncate-string-to-width tab-name l-name
41 (max 0 (- l-name tab-bar-tab-name-truncated-max l-ell))))
42 'help-echo tab-name))))
43
24 44
25;; Emacs 27 45;; Emacs 27
26 46