GNU bug report logs -
#61239
30.0.50; Display property value `((space :align-to))` doesn't handle line numbers
Previous Next
Reported by: Narendra Joshi <narendraj9 <at> gmail.com>
Date: Thu, 2 Feb 2023 21:28:01 UTC
Severity: normal
Tags: notabug, wontfix
Found in version 30.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #13 received at 61239 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Thank a lot for the explanation :)
Best,
Narendra
On Fri, Feb 3, 2023, 09:54 Eli Zaretskii <eliz <at> gnu.org> wrote:
> tags 61239 notabug wontfix
> thanks
>
> > From: Narendra Joshi <narendraj9 <at> gmail.com>
> > Date: Thu, 02 Feb 2023 22:26:57 +0100
> >
> >
> > The following code demonstrates the behavior:
> >
> > (display-line-numbers-mode +1)
> > (setq header-line-format
> > (concat (propertize " " 'display '((space :align-to 0))) "Column"))
> >
> > With line numbers displayed, the text above, i.e. "Column" doesn't align
> > wit the text in the buffer. This is problematic for modes like SES mode
> > (https://www.gnu.org/software/emacs/manual/html_node/ses/index.html).
>
>
> The :align-to values in header-line and mode-line do not automatically
> account for line numbers when display-line-numbers-mode is turned on.
> This is because the display engine cannot possibly know whether the
> application does or doesn't want this; we certainly don't want that
> for mode-line, for example. For header lines, there's no guarantee
> that the text there must align with the buffer text: that is up to the
> application to decide.
>
> So if a Lisp program wants the header-line indentation to be updated
> according to the screen estate taken by line numbers, it should do the
> following:
>
> . turn on the minor mode header-line-indent-mode
> . include header-line-indent-width in the :align-to expression
>
> In your case, the following change in the :align-to should do what you
> want:
>
> (setq header-line-format
> (concat (propertize " "
> 'display
> '(space :align-to
> (+ header-line-indent-width 0)))
> "Column"))
>
> You can see further examples of using this in tabulated-list-mode.el.
>
> I see that the ELisp manual doesn't mention this minor mode, and
> moreover, has some text which might mislead you into thinking that the
> header-line display will automatically be updated to account for the
> line numbers; I will fix the manual soon.
>
[Message part 2 (text/html, inline)]
This bug report was last modified 2 years and 111 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.