unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Matthias Meulien <orontee@gmail.com>
To: Juri Linkov <juri@linkov.net>
Cc: 41372@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	[thread overview]
Message-ID: <87d06umnq1.fsf@gmail.com> (raw)
In-Reply-To: <87tv0b7dtf.fsf@mail.linkov.net> (Juri Linkov's message of "Wed,  20 May 2020 01:35:56 +0300")

[-- Attachment #1: Type: text/plain, Size: 425 bytes --]

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:


[-- Attachment #2: 0001-Fix-tab-bar-tab-name-ellipsis-initialization.patch --]
[-- Type: text/x-diff, Size: 1679 bytes --]

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))))
 
 \f
-- 
2.20.1


[-- Attachment #3: Type: text/plain, Size: 14 bytes --]


-- 
Matthias

  reply	other threads:[~2020-05-23 19:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17 22:35 bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis Matthias Meulien
2020-05-19 22:35 ` Juri Linkov
2020-05-23 19:54   ` Matthias Meulien [this message]
2020-05-23 22:28     ` Juri Linkov
2020-05-24  2:33       ` Eli Zaretskii
2020-05-24 22:02         ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d06umnq1.fsf@gmail.com \
    --to=orontee@gmail.com \
    --cc=41372@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).