GNU bug report logs - #76566
[PATCH] Implement display-line-numbers-spacing-width

Previous Next

Package: emacs;

Reported by: Miro Palmu <email <at> miropalmu.cc>

Date: Tue, 25 Feb 2025 19:44:02 UTC

Severity: wishlist

Tags: notabug, patch, wontfix

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 76566 in the body.
You can then email your comments to 76566 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#76566; Package emacs. (Tue, 25 Feb 2025 19:44:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Miro Palmu <email <at> miropalmu.cc>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 25 Feb 2025 19:44:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Miro Palmu <email <at> miropalmu.cc>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Implement display-line-numbers-spacing-width
Date: Tue, 25 Feb 2025 18:40:07 +0200
[Message part 1 (text/plain, inline)]
Currently there is hard coded one character wide spacing around line 
numbers.
This patch adds `display-line-numbers-spacing-width' (default: 1),
which allows to configure the width of the spacing.
This is mostly motivated by wanting to set the spacing to zero.


This is result of make -C test:

SUMMARY OF TEST RESULTS
-----------------------
Files examined: 528
Ran 7991 tests, 7784 results as expected, 1 unexpected, 206 skipped
1 files contained unexpected results:
  lisp/progmodes/c-ts-mode-tests.log

1 unexpected results:
   FAILED  c-ts-mode-test-indentation

I assume that failing c-ts-mode-test-indentation is unrelated to this patch.


Miro Palmu
[0001-Implement-display-line-numbers-spacing-width.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76566; Package emacs. (Tue, 25 Feb 2025 19:58:02 GMT) Full text and rfc822 format available.

Message #8 received at 76566 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Miro Palmu <email <at> miropalmu.cc>
Cc: 76566 <at> debbugs.gnu.org
Subject: Re: bug#76566: [PATCH] Implement display-line-numbers-spacing-width
Date: Tue, 25 Feb 2025 21:57:29 +0200
> Date: Tue, 25 Feb 2025 18:40:07 +0200
> From:  Miro Palmu via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> Currently there is hard coded one character wide spacing around line 
> numbers.
> This patch adds `display-line-numbers-spacing-width' (default: 1),
> which allows to configure the width of the spacing.
> This is mostly motivated by wanting to set the spacing to zero.

Thanks, but I'm not sure I like this feature, especially when there
are no spaces.

Why is this needed?




Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 25 Feb 2025 23:22:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76566; Package emacs. (Wed, 26 Feb 2025 09:42:02 GMT) Full text and rfc822 format available.

Message #13 received at 76566 <at> debbugs.gnu.org (full text, mbox):

From: Miro Palmu <email <at> miropalmu.cc>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 76566 <at> debbugs.gnu.org
Subject: Re: bug#76566: [PATCH] Implement display-line-numbers-spacing-width
Date: Wed, 26 Feb 2025 09:32:19 +0200
> Thanks, but I'm not sure I like this feature, especially when there
> are no spaces.
> 
> Why is this needed?


I like to use relative numbering and maximize available room for text.
Columns taken by line numbers go from 4 to 2 when the spacing is set to zero.
Setting just display-line-numbers-width does not remove the spaces.


Here is Emacs stackexchange question asking the same thing,
which motivated me to try to implement the feature:
https://emacs.stackexchange.com/q/52269

So, there is desire to customize or at least remove the spaces.
However, the approach of `display-line-numbers-spacing-width'
might not be the best one. It was one that was easy to implement.

Also, I noticed that my doc string has mistake. It says:

> Any other value than non-negative integer is treated as 1.

but it should be:

> Negative values are treated as zero.


Miro Palmu





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76566; Package emacs. (Wed, 26 Feb 2025 16:09:01 GMT) Full text and rfc822 format available.

Message #16 received at 76566 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Miro Palmu <email <at> miropalmu.cc>
Cc: 76566 <at> debbugs.gnu.org
Subject: Re: bug#76566: [PATCH] Implement display-line-numbers-spacing-width
Date: Wed, 26 Feb 2025 18:08:21 +0200
> Date: Wed, 26 Feb 2025 09:32:19 +0200
> Cc: 76566 <at> debbugs.gnu.org
> From: Miro Palmu <email <at> miropalmu.cc>
> 
> > Thanks, but I'm not sure I like this feature, especially when there
> > are no spaces.
> > 
> > Why is this needed?
> 
> 
> I like to use relative numbering and maximize available room for text.

And you cannot achieve that by customizing the line-number face to use
a font where the SPC character is thin enough for your taste?

> Columns taken by line numbers go from 4 to 2 when the spacing is set to zero.
> Setting just display-line-numbers-width does not remove the spaces.

Completely removing the space will show the numbers as if they were
part of buffer test, which will be confusing.  The space makes the
numbers stand out.  AFAIK, all the other IDEs which show line numbers
also have some separators.

In any case, disabling the spaces and controlling how many spaces are
there are not the same: the former is just a boolean flag, whereas the
latter is more complex, and the code will be slower.  This mode was
implemented in the display engine to solve the performance impact of
linum-mode, so I'm not very fond of adding hair to it and slowing it
down.  People who want fancy customization of the line numbers can
simply use linum-mode.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76566; Package emacs. (Wed, 26 Feb 2025 18:56:02 GMT) Full text and rfc822 format available.

Message #19 received at 76566 <at> debbugs.gnu.org (full text, mbox):

From: Miro Palmu <email <at> miropalmu.cc>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 76566 <at> debbugs.gnu.org
Subject: Re: bug#76566: [PATCH] Implement display-line-numbers-spacing-width
Date: Wed, 26 Feb 2025 18:56:34 +0200
> And you cannot achieve that by customizing the line-number face to use
> a font where the SPC character is thin enough for your taste?

Did not think of this. Thanks.

> In any case, disabling the spaces and controlling how many spaces are
> there are not the same: the former is just a boolean flag, whereas the
> latter is more complex, and the code will be slower.  This mode was
> implemented in the display engine to solve the performance impact of
> linum-mode, so I'm not very fond of adding hair to it and slowing it
> down.  People who want fancy customization of the line numbers can
> simply use linum-mode.


Understandable.


Miro Palmu





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76566; Package emacs. (Fri, 28 Feb 2025 09:16:01 GMT) Full text and rfc822 format available.

Message #22 received at 76566 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Miro Palmu <email <at> miropalmu.cc>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 76566 <at> debbugs.gnu.org
Subject: Re: bug#76566: [PATCH] Implement display-line-numbers-spacing-width
Date: Fri, 28 Feb 2025 01:15:36 -0800
tags 76566 + notabug wontfix
close 76566
thanks

Miro Palmu via "Bug reports for GNU Emacs, the Swiss army knife of text
editors" <bug-gnu-emacs <at> gnu.org> writes:

>> And you cannot achieve that by customizing the line-number face to use
>> a font where the SPC character is thin enough for your taste?
>
> Did not think of this. Thanks.
>
>> In any case, disabling the spaces and controlling how many spaces are
>> there are not the same: the former is just a boolean flag, whereas the
>> latter is more complex, and the code will be slower.  This mode was
>> implemented in the display engine to solve the performance impact of
>> linum-mode, so I'm not very fond of adding hair to it and slowing it
>> down.  People who want fancy customization of the line numbers can
>> simply use linum-mode.
>
>
> Understandable.

Thanks, I'm therefore closing this bug report.




Added tag(s) wontfix and notabug. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 28 Feb 2025 09:16:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 76566 <at> debbugs.gnu.org and Miro Palmu <email <at> miropalmu.cc> Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 28 Feb 2025 09:16:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 28 Mar 2025 11:24:15 GMT) Full text and rfc822 format available.

This bug report was last modified 81 days ago.

Previous Next


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