GNU bug report logs - #67248
30.0.50; string-pixel-width is affected by the global value of display-line-numbers

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Fri, 17 Nov 2023 21:25:02 UTC

Severity: normal

Found in version 30.0.50

Fixed in version 29.2

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 67248 <at> debbugs.gnu.org
Subject: bug#67248: 30.0.50; string-pixel-width is affected by the global value of display-line-numbers
Date: Sat, 18 Nov 2023 09:14:24 +0200
> Date: Fri, 17 Nov 2023 23:23:58 +0200
> From: Dmitry Gutov <dgutov <at> yandex.ru>
> 
> 1. (string-pixel-width "abc") ; => 51
> 2. (customize-set-variable 'display-line-numbers t)
> 3. (string-pixel-width "abc") ; => 119
> 
> This function's implementation makes provision for
> display-line-numbers-mode, but not for the original variable
> display-line-numbers, which will be t independent of the value of
> display-line-numbers-mode.
> 
> I think it's a bad idea to have these two different ways to do the same
> thing, and it can lead to bugs like this one. I would suggest obsoleting
> the public use of display-line-numbers -- making it private, probably.
> At least removing it from the customization group display-line-numbers.

I don't see a need for such drastic measures, certainly not due to
this bug.  Having the variable and the mode in this case is not
different from other similar cases, for example, word-wrap vs
visual-line-mode.  You have just discovered that the test in
string-pixel-width was not the correct one, that's all.

> Barring that, the patch below seems to work.  Although it proliferates
> the differences between Emacs versions which one would have to be on the
> lookout for.

Thanks, I think this is indeed the right solution.  Please install the
patch on the emacs-29 branch.




This bug report was last modified 1 year and 237 days ago.

Previous Next


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