From: Eli Zaretskii <eliz@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: 59311@debbugs.gnu.org, gabriel376@hotmail.com
Subject: bug#59311: 29.0.50; tab-bar global-mode-string affected by global-display-line-numbers
Date: Sun, 20 Nov 2022 10:36:35 +0200 [thread overview]
Message-ID: <83tu2u58fg.fsf@gnu.org> (raw)
In-Reply-To: <86r0xyvxmr.fsf@mail.linkov.net> (message from Juri Linkov on Sun, 20 Nov 2022 10:20:40 +0200)
> From: Juri Linkov <juri@linkov.net>
> Cc: gabriel376@hotmail.com, 59311@debbugs.gnu.org
> Date: Sun, 20 Nov 2022 10:20:40 +0200
>
> > No, because line-numbers take space, and some use cases of
> > buffer-text-pixel-size want to know that. Only the caller knows whether the
> > line-numbers should or shouldn't be included. The principle is that we
> > measure the space taken in the text-area, no matter how it is used. (There
> > are other display features that affect the result, for example,
> > line-prefix.)
>
> I still don't understand why string-pixel-width should handle line-numbers
> that also degrades its performance.
Because string-pixel-width uses a temporary buffer as its internal
implementation detail. (And why do you think this degrades performance? any
measurements?)
> I think it should be sufficient only
> to disable line-numbers in internal buffers.
I think it's too late for that, since display-line-numbers-mode is with us
for the last 2 major releases.
> But ok, here are both:
>
> diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
> index 6e4d88b4df..fba817b010 100644
> --- a/lisp/emacs-lisp/subr-x.el
> +++ b/lisp/emacs-lisp/subr-x.el
> @@ -324,7 +324,8 @@ string-pixel-width
> (with-current-buffer (get-buffer-create " *string-pixel-width*")
> (delete-region (point-min) (point-max))
> (insert string)
> - (car (buffer-text-pixel-size nil nil t)))))
> + (- (car (buffer-text-pixel-size nil nil t))
> + (line-number-display-width t)))))
This is fine by me. (Or you could turn off display-line-numbers-mode
instead, right after with-current-buffer.)
> ;;;###autoload
> (defun string-glyph-split (string)
> diff --git a/lisp/display-line-numbers.el b/lisp/display-line-numbers.el
> index 897a88398f..cf5d353fba 100644
> --- a/lisp/display-line-numbers.el
> +++ b/lisp/display-line-numbers.el
> @@ -101,7 +101,8 @@ display-line-numbers-mode
>
> (defun display-line-numbers--turn-on ()
> "Turn on `display-line-numbers-mode'."
> - (unless (minibufferp)
> + (unless (or (minibufferp)
> + (string-match-p "\\` " (buffer-name)))
> (display-line-numbers-mode)))
I don't agree with this part.
Thanks.
next prev parent reply other threads:[~2022-11-20 8:36 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 16:10 bug#59311: 29.0.50; tab-bar global-mode-string affected by global-display-line-numbers Gabriel
2022-11-18 7:15 ` Juri Linkov
2022-11-18 8:42 ` Eli Zaretskii
2022-11-18 9:46 ` Juanma Barranquero
2022-11-18 11:48 ` Eli Zaretskii
2022-11-19 19:03 ` Juri Linkov
2022-11-19 19:46 ` Eli Zaretskii
2022-11-20 8:20 ` Juri Linkov
2022-11-20 8:36 ` Eli Zaretskii [this message]
2022-11-20 18: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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83tu2u58fg.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=59311@debbugs.gnu.org \
--cc=gabriel376@hotmail.com \
--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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.