[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis
From: |
Matthias Meulien |
Subject: |
bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis |
Date: |
Sat, 23 May 2020 21:54:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Juri Linkov <juri@linkov.net> writes:
Thanks for the patch. One problem is that the patch hard-codes
the ellipsis, so that the user loses the ability to configure
it.
A better way would be to leave defvar tab-bar-tab-name-ellipsis,
but by default set its value to nil. So when it's non-nil, then
use its value, otherwise use "…"/"..." by default.
You're right. Here's un updated patch:
>From d607000155a21340aebd101ee5dc4a12037088d7 Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee@gmail.com>
Date: Mon, 18 May 2020 00:32:47 +0200
Subject: [PATCH] Fix tab-bar-tab-name-ellipsis initialization
* lisp/tab-bar.el (tab-bar-tab-name-truncated): Evaluate displayable
character when generating tab name.
---
lisp/tab-bar.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index ce6d8c33dd..d24d59cb7e 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -376,19 +376,22 @@ tab-bar-tab-name-truncated-max
:group 'tab-bar
:version "27.1")
-(defvar tab-bar-tab-name-ellipsis
- (if (char-displayable-p ?…) "…" "..."))
+(defvar tab-bar-tab-name-ellipsis nil)
(defun tab-bar-tab-name-truncated ()
"Generate tab name from the buffer of the selected window.
Truncate it to the length specified by `tab-bar-tab-name-truncated-max'.
Append ellipsis `tab-bar-tab-name-ellipsis' in this case."
- (let ((tab-name (buffer-name (window-buffer (minibuffer-selected-window)))))
+ (let ((tab-name (buffer-name (window-buffer (minibuffer-selected-window))))
+ (ellipsis (cond
+ (tab-bar-tab-name-ellipsis)
+ ((char-displayable-p ?…) "…")
+ ("..."))))
(if (< (length tab-name) tab-bar-tab-name-truncated-max)
tab-name
(propertize (truncate-string-to-width
tab-name tab-bar-tab-name-truncated-max nil nil
- tab-bar-tab-name-ellipsis)
+ ellipsis)
'help-echo tab-name))))
--
2.20.1
--
Matthias