unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis
@ 2020-05-17 22:35 Matthias Meulien
  2020-05-19 22:35 ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Matthias Meulien @ 2020-05-17 22:35 UTC (permalink / raw)
  To: 41372

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


When I evaluate (char-displayable-p ?…) from current frame (under X) it
evaluates to a valid font but, after I customized
`tab-bar-tab-name-function` to equal `tab-bar-tab-name-truncated`, tab
names are truncated using three dots characters.


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

From 6482236257c99dcd411d635360ce4c1d8144b3f0 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, 4 insertions(+), 7 deletions(-)

diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index ce6d8c33dd..c327ac0967 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -376,19 +376,16 @@ tab-bar-tab-name-truncated-max
   :group 'tab-bar
   :version "27.1")
 
-(defvar tab-bar-tab-name-ellipsis
-  (if (char-displayable-p ?…) "…" "..."))
-
 (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)))))
+Truncate it to the length specified by `tab-bar-tab-name-truncated-max'."
+  (let ((tab-name (buffer-name (window-buffer (minibuffer-selected-window))))
+        (ellipsis (if (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: 3486 bytes --]




In GNU Emacs 28.0.50 (build 9, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2020-05-16 built on carbon
Repository revision: 1ba4e5b5eb7360338c5ed750c8e4a2b09835f78b
Repository branch: dev/mm
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)

Recent messages:
Creating customization setup...done
You can run the command ‘customize-group’ with M-x cu-g RET
Creating customization setup...done
Mark saved where search started
Show the value of this option.
Show or hide rest of the documentation.
Show the value of this option.
Choice: 2
To install your edits, invoke [State] and choose the Set operation
Set all values according to this buffer? (y or n) y

Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND GPM DBUS GSETTINGS GLIB NOTIFY
INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF
ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS JSON PDUMPER
LCMS2 GMP

Important settings:
  value of $LC_MONETARY: fr_FR.UTF-8
  value of $LC_NUMERIC: fr_FR.UTF-8
  value of $LC_TIME: fr_FR.UTF-8
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Custom

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils seq byte-opt gv bytecomp byte-compile cconv mule-util
misearch multi-isearch cus-edit easymenu cus-start cus-load wid-edit
cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 67053 5417)
 (symbols 48 7511 1)
 (strings 32 19027 1185)
 (string-bytes 1 596724)
 (vectors 16 11021)
 (vector-slots 8 133160 11144)
 (floats 8 32 63)
 (intervals 56 484 14)
 (buffers 992 14))

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2020-05-19 22:35 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: 41372

> When I evaluate (char-displayable-p ?…) from current frame (under X) it
> evaluates to a valid font but, after I customized
> `tab-bar-tab-name-function` to equal `tab-bar-tab-name-truncated`, tab
> names are truncated using three dots characters.

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.

> -(defvar tab-bar-tab-name-ellipsis
> -  (if (char-displayable-p ?…) "…" "..."))
> -
>  (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)))))
> +Truncate it to the length specified by `tab-bar-tab-name-truncated-max'."
> +  (let ((tab-name (buffer-name (window-buffer (minibuffer-selected-window))))
> +        (ellipsis (if (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)





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis
  2020-05-19 22:35 ` Juri Linkov
@ 2020-05-23 19:54   ` Matthias Meulien
  2020-05-23 22:28     ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Matthias Meulien @ 2020-05-23 19:54 UTC (permalink / raw)
  To: Juri Linkov; +Cc: 41372

[-- 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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis
  2020-05-23 19:54   ` Matthias Meulien
@ 2020-05-23 22:28     ` Juri Linkov
  2020-05-24  2:33       ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Juri Linkov @ 2020-05-23 22:28 UTC (permalink / raw)
  To: Matthias Meulien; +Cc: 41372

>> 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:

Eli, this patch should go to emacs-27?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis
  2020-05-23 22:28     ` Juri Linkov
@ 2020-05-24  2:33       ` Eli Zaretskii
  2020-05-24 22:02         ` Juri Linkov
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2020-05-24  2:33 UTC (permalink / raw)
  To: Juri Linkov; +Cc: orontee, 41372

> From: Juri Linkov <juri@linkov.net>
> Date: Sun, 24 May 2020 01:28:12 +0300
> Cc: 41372@debbugs.gnu.org
> 
> >> 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:
> 
> Eli, this patch should go to emacs-27?

I'm okay with doing that on emacs-27, yes.

Thanks.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis
  2020-05-24  2:33       ` Eli Zaretskii
@ 2020-05-24 22:02         ` Juri Linkov
  0 siblings, 0 replies; 6+ messages in thread
From: Juri Linkov @ 2020-05-24 22:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: orontee, 41372

tags 41372 fixed
close 41372 27.1
thanks

>> >> 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:
>> 
>> Eli, this patch should go to emacs-27?
>
> I'm okay with doing that on emacs-27, yes.

Now pushed to emacs-27.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-24 22:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2020-05-23 22:28     ` Juri Linkov
2020-05-24  2:33       ` Eli Zaretskii
2020-05-24 22:02         ` Juri Linkov

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).