[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: |
Juri Linkov |
Subject: |
bug#41372: 28.0.50; [PATCH] Wrong value of tab-bar-tab-name-ellipsis |
Date: |
Wed, 20 May 2020 01:35:56 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
> 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)