GNU bug report logs - #28855
26.0.90; display-line-numbers-mode does not respect (line|wrap)-prefix '(space :align-to N) text property

Previous Next

Package: emacs;

Reported by: Paul Rankin <hello <at> paulwrankin.com>

Date: Mon, 16 Oct 2017 03:39:01 UTC

Severity: normal

Found in version 26.0.90

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Rankin <hello <at> paulwrankin.com>
Cc: 28855 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: Re: bug#28855: 26.0.90;
 display-line-numbers-mode does not respect (line|wrap)-prefix '(space
 :align-to N) text property
Date: Tue, 17 Oct 2017 08:49:12 +0300
On October 17, 2017 7:32:18 AM GMT+03:00, Paul Rankin <hello <at> paulwrankin.com> wrote:
> On Tue, 17 Oct 2017, at 02:04 PM, Eli Zaretskii wrote:
> > > :align-to does align to its value, it just doesn't currently
> update it
> > > to account for the space taken by line numbers.
> 
> Justifying a bug doesn’t fix it.
> 
> > > It's clear that the change I have in mind will solve your specific
> > > problem, I just want to hear from others whether it could harm
> > > something.
> > 
> > Btw, in case it wasn't clear: a solution for this is already
> available --
> > use line-number-display-width when computing the value of :align-to.
> > Like tabulated-list-mode already does.
> > 
> > I'm just trying to establish if a more convenient solution could be
> possible.
> 
> Further to the cited discussion, if taken to its logical conclusions,
> this approach reaches a point of absurdity, e.g.
> 
> Three lines with respective :align-to property values of 0, 2 and 4
> should appear like this:
> 
>     foo
>       bar
>         baz
> 
> However what we get when these lines occur at line 1000 with
> display-line-numbers-mode enabled is:
> 
>     1000 foo
>     1001 bar
>     1002 baz
> 
> Or, given that the line numbers take up a width of 4 characters, and
> we don’t account for this width, then logically do we now truncate the
> leading 4 and 2 characters....?
> 
>     1000 
>     1001 r
>     1002 baz

Not sure what is alluded to as "this approach".

My last point is that instead of 0, 2, and 4, you can use those values plus what
line-number-display-width returns, and then you will have your expected
result.




This bug report was last modified 7 years and 218 days ago.

Previous Next


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