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


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

From: martin rudalics <rudalics <at> gmx.at>
To: Paul Rankin <hello <at> paulwrankin.com>
Cc: 28844 <at> debbugs.gnu.org
Subject: Re: bug#28844: 26.0.90; display-line-numbers-mode should call
 window-configuration-change-hook
Date: Sun, 15 Oct 2017 14:12:30 +0200
>> ‘window-configuration-change-hook’ is still run way too often, for
>> example, when windows get resized.  ‘window-size-change-functions’ might
>> be better.  But if you need such a hook, wouldn't you also need it when
>> line numbers occupy more or less columns, for example, during scrolling?
>>
>> Otherwise, why can't you use ‘display-line-numbers-mode-hook’?
>

> Thanks for pointing me to display-line-numbers-mode-hook, but I’ve
> found that it’s not enough to just check when the mode is enabled. We
> need to alert other concerned modes whenever display-line-numbers-mode
> changes the margins, e.g. due to scrolling from line 99 to 100 (which
> will increase the width from 2 to 3).

That's what I meant when I said that

  "if you need such a hook, wouldn't you also need it when line numbers
  occupy more or less columns, for example, during scrolling?"

You could use ‘window-scroll-functions’ (remembering the old line number
widths) for scrolling but this would not handle simple point movements.

Eli will decide what to do.  If an existing hook must be chosen, I'd
rather (mis-)use ‘window-size-change-functions’ - strictly spoken,
display of line numbers never affects the size of windows (something
which is not true vice-versa IIUC).  But better, provide a separate hook
like ‘line-number-width-changed-functions’ with the corresponding window
as argument (and maybe the old line number width as second).

martin





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.