From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: 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-ID: References: <83v9m7n98j.fsf@gnu.org> <83r1wvmt7k.fsf@gnu.org> <83ftdbmjan.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="00000000000021b7bb05a31706e0" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="32834"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 40529@debbugs.gnu.org, Aidan Beggs To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 12 14:23:24 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jNbdz-0008RO-NB for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 14:23:23 +0200 Original-Received: from localhost ([::1]:33136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNbdy-0004aH-Q6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Apr 2020 08:23:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53083) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jNbdg-0004O6-3l for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 08:23:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jNbde-0002EZ-Ra for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 08:23:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45936) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jNbde-0002EL-Oz for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 08:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jNbde-0006y1-KC for bug-gnu-emacs@gnu.org; Sun, 12 Apr 2020 08:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Apr 2020 12:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 40529 X-GNU-PR-Package: emacs Original-Received: via spool by 40529-submit@debbugs.gnu.org id=B40529.158669417326744 (code B ref 40529); Sun, 12 Apr 2020 12:23:02 +0000 Original-Received: (at 40529) by debbugs.gnu.org; 12 Apr 2020 12:22:53 +0000 Original-Received: from localhost ([127.0.0.1]:57482 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNbdU-0006xI-Ng for submit@debbugs.gnu.org; Sun, 12 Apr 2020 08:22:53 -0400 Original-Received: from mail-il1-f171.google.com ([209.85.166.171]:37346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jNbdT-0006x4-JR for 40529@debbugs.gnu.org; Sun, 12 Apr 2020 08:22:52 -0400 Original-Received: by mail-il1-f171.google.com with SMTP id e4so3929013ils.4 for <40529@debbugs.gnu.org>; Sun, 12 Apr 2020 05:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Gfdo36VZ4s/eI8K7acpgE8I7ac182KxgBWjH7cSdII0=; b=Rpq+VX9FPA3zvJO4Zy5rlxXr21mqweJXkwP5UTSS828IpoWjdyj75xCaEhfw8jzFrk LR+drLXNzbpG1FYRC4D2YPDrVuH6AXfdHcfDHypn1v53pCSm/exhivgBJIU8t3vL1VIl lrAs5LGxs/qUjiJSDsuSnxQ9s2gv9NZZLmbKbVRK9jvpavMj3d7NvoQG2iUdmJPAlWe0 7mqC5pa8xoxb3zzSJG8VakLiw6M1rEfP3q0kKpksKXAEk9Axx091nqjUqbXKl9pCGE4X 2xcEf7tXeEEB0HDGv9geQxZjE57GkJycqjdsp2DR7L3nE/ycNGrkQX23CVqS5CSuJ1mQ Or7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Gfdo36VZ4s/eI8K7acpgE8I7ac182KxgBWjH7cSdII0=; b=nDLpoWpxE5yRVjf1QkW0JAqNuy+5rfiZC1NRnH7boIPd9IrbfoR4a1z+wFpk17Aqf5 7tGJDaRsEmS8UMPQVDkilyQft3Z6TpeU1fqSgDkxre3tWcfQ0d/8rI2wOSggP/Y226nc r4Qk2ckhiDi6+6dx9Oo25G9cZlj2PcZCJg8vvRr5SL5nadhCAhG0mO8XdtAJ0+DZCAi+ IlQ5EnT61QElx5JglpYHNgeLMtVjUEuP6OqQmrvIwGitudPzJcwq3makNqkZ6kxlXyth /XianvURhA4VE2jxotx5qJ3o4+a+mUMkQN5+3qWFmEBhJER+p5w7AVxqSKYNwxSttShP 2Rcg== X-Gm-Message-State: AGi0PuZ/mGAQR+mEqM2W1T4GUF59GBt1JNg+Skr0VzplUR4fPUyCaP90 Gw8fSIIWxnCm7oJEOIRPt0cDas/pAtjoNpYz3rc= X-Google-Smtp-Source: APiQypJ0qsLsw+XRUZWze1Jtyp0eV7NEDkxW8b+1q/a8rTZ4C52kL3DWlttLVjxFWxDcO6+qqix49uj1Oun12Qrhe/0= X-Received: by 2002:a05:6e02:6c1:: with SMTP id p1mr13388301ils.137.1586694165999; Sun, 12 Apr 2020 05:22:45 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:178238 Archived-At: --00000000000021b7bb05a31706e0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Apr 10, 2020 at 5:16 PM Jo=C3=A3o T=C3=A1vora wrote: > > On Fri, Apr 10, 2020 at 5:09 PM Jo=C3=A3o T=C3=A1vora 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=C3=A3o T=C3=A1vora 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) --00000000000021b7bb05a31706e0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Apr 10, 2020 at 5:16 PM Jo=C3=A3o T=C3=A1vora <= joaotavora@gmail.com> wrote:=
>
> On Fri, Apr 10, 2020 at 5:09 PM Jo=C3=A3o T=C3=A1vora <= joaotavora@gmail.com> wrote:=
>
> > leaves me wondering if there isn't a hook orderin= g bug here. Maybe it's
> > just a question of delaying entry i= n 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/flymak= e.el

Finally looked into the problem and no, this doesn't work b= ecause
flymake-diagnostics-buffer-mode erases local vars before setting = up the
tabulated-list-mode derived mode.=C2=A0 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 rat= her
its recent adaptation to display-line-numbers-mode, which is in the<= br>wrong here.=C2=A0 It used to be that using a mode derived from
t= abulated-list-mode didn't immediately force a request for refreshing it= s
rows.=C2=A0 After display-line-numbers-mode came along, th= at ceased to be
true in some situations.

Reading the special co= de in tabulated-list-mode concerned with line
numbers, the latter seem t= o affect only the header line, not the
buffer's contents.=C2=A0 So t= his seems to be the correct fix:

commit 0145b3c87f329e51c729703d7788= 48cdc8393a33
Author: Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com>
Date: =C2=A0 Sun Apr 12 13:1= 0:45 2020 +0100

=C2=A0 =C2=A0 Fix tabulated-list-mode bootstrapping = problem
=C2=A0 =C2=A0
=C2=A0 =C2=A0 Fixes: bug#40529
=C2=A0 =C2= =A0 Don't refresh all the tabulated-list rows when entering
=C2=A0 = =C2=A0 tabulated-list-mode just because display-line-number-mode is t.
= =C2=A0 =C2=A0
=C2=A0 =C2=A0 * lisp/emacs-lisp/tabulated-list.el (tabula= ted-list-mode): Don't
=C2=A0 =C2=A0 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
=C2=A0 =C2= =A0;; column of the first entry happens to begin with a R2L letter.
=C2= =A0 =C2=A0(setq bidi-paragraph-direction 'left-to-right)
=C2=A0 =C2= =A0;; This is for if/when they turn on display-line-numbers
- =C2=A0(add= -hook 'display-line-numbers-mode-hook #'tabulated-list-revert nil t= )
+ =C2=A0(add-hook 'display-line-numbers-mode-hook #'tabulated-= list-init-header nil t)
=C2=A0 =C2=A0;; This is for if/when they customi= ze the line-number face or when
=C2=A0 =C2=A0;; the line-number width ne= eds to change due to scrolling.
=C2=A0 =C2=A0(setq-local tabulated-list-= -current-lnum-width 0)
--00000000000021b7bb05a31706e0--