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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 19 Oct 2017 06:26:57 +0300

> From: Alex <[email-masked]>
> Cc: martin rudalics <[email-masked]>,  [email-masked],  [email-masked],  [email-masked],  [email-masked]
> Date: Wed, 18 Oct 2017 17:58:03 -0600
> 
> > Actually, it's the other way around: the current behavior is that
> > :align-to always starts counting from the window edge, even if line
> > numbers are displayed, so the effect of ":align-to N" is as if N has
> > been reduced by the screen space used for displaying the numbers.
> 
> By "window edge" do you mean the edge of the text area?

Yes (although it turned out during a previous discussion that "text
area" is not understood the same by all the parties ;-)

> Since AFAICT there's no current way to specify alignment relative to
> the window edges. This is what the 2nd part of Bug#28771 is about.

You are talking about header-line, otherwise such origin makes little
sense.  As I said in that bug, I'd rather provide higher-level
features, like centering a string in the header-line regardless of
whatever factors can affect the centering.  Assuming that your request
is motivated by such layout requirements, that is.  (But let's not
talk here about the issues raised there.)

> > The changes I'm about to install make :align-to work as you described
> > above, i.e. start measuring the offset from where the line-number
> > display ends.
> 
> What about starting the measurement from after the line-prefix attribute
> as well?

I don't plan doing that, certainly not for Emacs 26.  The line-prefix
and wrap-prefix are very old features, and no one asked for :align-to
to know about them till now, so presumably it isn't very important.
(It also sounds like :align-to itself is rarely used and sometimes is
entirely unfamiliar-with.  I certainly don't see some of its features
used in Emacs at all, which makes me wonder why did we implement them
in Emacs 21.)

> > After the change, if someone wants to always measure the offset from
> > the window edge, they could/should use
> >
> >   :align-to (+ left-fringe left-fringe N)
> 
> > > Unless ‘fringes-outside-margins’ is non-nil and there's a left margin.
> > For that, there's left-margin that can play the same role.
> 
> If there's a distinct element for line-numbers, then you don't have to
> worry about what elements are on the left, or what order they're in.

My assumption is that no one will need to worry about that because
everybody will want the automatic accounting for the line numbers I'm
about to implement.  The above is just a fire escape I don't envision
to be needed, certainly not frequently.