GNU bug report logs - #40529
26.3; global-display-line-numbers-mode and flymake-show-diagnostics-buffer error

Previous Next

Package: emacs;

Reported by: Aidan Beggs <nadiasggeb001 <at> gmail.com>

Date: Thu, 9 Apr 2020 22:07:02 UTC

Severity: normal

Found in version 26.3

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

Bug is archived. No further changes may be made.

Full log


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

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 40529 <at> debbugs.gnu.org, Aidan Beggs <nadiasggeb001 <at> gmail.com>
Subject: Re: bug#40529: 26.3; global-display-line-numbers-mode and
 flymake-show-diagnostics-buffer error
Date: Sun, 12 Apr 2020 13:22:34 +0100
[Message part 1 (text/plain, inline)]
On Fri, Apr 10, 2020 at 5:16 PM João Távora <joaotavora <at> gmail.com> wrote:
>
> On Fri, Apr 10, 2020 at 5:09 PM João Távora <joaotavora <at> gmail.com> wrote:
>
> > leaves me wondering if there isn't a hook ordering bug here. Maybe it's
> > just a question of delaying entry in tabulated-list-mode until
important stuff
> > is set up.
>
> Or maybe all that's needed is this (100% untested) change:
>
> diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el

Finally looked into the problem and no, this doesn't work because
flymake-diagnostics-buffer-mode erases local vars before setting up the
tabulated-list-mode derived mode.  This is kind of a chicken-and-egg
issue that can only be fixed in flymake.el with some ugly hacks.

But after some analysis, I think it is tabulated-list-mode, or rather
its recent adaptation to display-line-numbers-mode, which is in the
wrong here.  It used to be that using a mode derived from
tabulated-list-mode didn't immediately force a request for refreshing its
rows.  After display-line-numbers-mode came along, that ceased to be
true in some situations.

Reading the special code in tabulated-list-mode concerned with line
numbers, the latter seem to affect only the header line, not the
buffer's contents.  So this seems to be the correct fix:

commit 0145b3c87f329e51c729703d778848cdc8393a33
Author: João Távora <joaotavora <at> gmail.com>
Date:   Sun Apr 12 13:10:45 2020 +0100

    Fix tabulated-list-mode bootstrapping problem

    Fixes: bug#40529
    Don't refresh all the tabulated-list rows when entering
    tabulated-list-mode just because display-line-number-mode is t.

    * lisp/emacs-lisp/tabulated-list.el (tabulated-list-mode): Don't
    call tabulated-list-revert, just tabulated-list-init-header.

diff --git a/lisp/emacs-lisp/tabulated-list.el
b/lisp/emacs-lisp/tabulated-list.el
index 501cc3a29e..68eaef1fcd 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -765,7 +765,7 @@ tabulated-list-mode
   ;; column of the first entry happens to begin with a R2L letter.
   (setq bidi-paragraph-direction 'left-to-right)
   ;; This is for if/when they turn on display-line-numbers
-  (add-hook 'display-line-numbers-mode-hook #'tabulated-list-revert nil t)
+  (add-hook 'display-line-numbers-mode-hook #'tabulated-list-init-header
nil t)
   ;; This is for if/when they customize the line-number face or when
   ;; the line-number width needs to change due to scrolling.
   (setq-local tabulated-list--current-lnum-width 0)
[Message part 2 (text/html, inline)]

This bug report was last modified 5 years and 123 days ago.

Previous Next


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