GNU bug report logs - #28844
26.0.90; display-line-numbers-mode should call window-configuration-change-hook

Previous Next

Package: emacs;

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

Date: Sun, 15 Oct 2017 07:57:01 UTC

Severity: minor

Found in version 26.0.90

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alex <agrambot <at> gmail.com>
To: Paul Rankin <hello <at> paulwrankin.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 28844 <at> debbugs.gnu.org
Subject: bug#28844: 26.0.90; display-line-numbers-mode should call window-configuration-change-hook
Date: Sun, 15 Oct 2017 22:59:35 -0600
Paul Rankin <hello <at> paulwrankin.com> writes:

> Because this doesn’t work. If it did I wouldn’t be posting it. Think about it;
> your mode updates the display on its own without notifying Emacs. The basic
> conceptual problem is that “every time you need the value” is predicated on when
> display-line-numbers-mode changes the value. There’s no way for another lisp
> program to know when that is.

I agree that Emacs should present a way to specify width that
automatically takes line numbers into account.

> Function featurep is enough to know if display-line-numbers is present (as
> above).

Actually, I'd recommend (boundp 'display-line-numbers), since the
feature `display-line-numbers' isn't loaded automatically in Emacs. It
should be noted that `display-line-numbers-mode' is just a minor mode
wrapper around the variable `display-line-numbers', which actually does
the work.

This also means that the hook `display-line-numbers-hook' isn't actually
enough to determine whether or not line numbers have been toggled (since
one can just toggle the variable instead). I'd say its main use is in
user configurations.

To see if line numbers are present in a buffer (and to make it
compatible with older Emacsen), you should use something like:

(bound-and-true-p display-line-numbers)




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

Previous Next


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