GNU bug report logs - #41372
28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis

Previous Next

Package: emacs;

Reported by: Matthias Meulien <orontee <at> gmail.com>

Date: Sun, 17 May 2020 22:37:02 UTC

Severity: minor

Tags: fixed, patch

Found in version 28.0.50

Fixed in version 27.1

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Matthias Meulien <orontee <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: 41372 <at> debbugs.gnu.org
Subject: bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis
Date: Sat, 23 May 2020 21:54:14 +0200
[Message part 1 (text/plain, inline)]
Juri Linkov <juri <at> 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:

[0001-Fix-tab-bar-tab-name-ellipsis-initialization.patch (text/x-diff, inline)]
From d607000155a21340aebd101ee5dc4a12037088d7 Mon Sep 17 00:00:00 2001
From: Matthias Meulien <orontee <at> 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

[Message part 3 (text/plain, inline)]
-- 
Matthias

This bug report was last modified 4 years and 359 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.