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: Eli Zaretskii <eliz <at> gnu.org>
To: Paul Rankin <hello <at> paulwrankin.com>
Cc: rudalics <at> gmx.at, 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 17:59:04 +0300
> From: Paul Rankin <hello <at> paulwrankin.com>
> Date: Sun, 15 Oct 2017 23:27:53 +1000
> Cc: 28844 <at> debbugs.gnu.org
> 
> This is all I should have to do, where WINDOW is the selected window and MARGIN is an integer:
> 
> -      (set-window-margins window margin margin))
> +      (set-window-margins window (if (featurep 'display-line-numbers)
> +                                     (- margin (line-number-display-width))
> +                                   margin)
> +                          margin))

Exactly.  So why do you need a hook?  Just call this every time you
need the value, and you will have the up-to-date one.

> Cool. As long as there is a hook. I appreciate inclusion of the function line-number-display-width, but introducing compatibility-breaking code then putting the onus on others to work around it is kinda rude. If there is a proper hook it eases the pain a bit.

If that's the problem, then you could provide a wrapper around
line-number-display-width for older versions of Emacs, which would
always return zero for those versions.  Or even explicitly check for
display-line-numbers being nil, which it always will be in older
versions, and return zero even without calling
line-number-display-width.  I believe this is the standard way of
dealing with these problems.




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.