Subject: Re: bug#40529: 26.3; global-display-line-numbers-mode and flymake-show-diagnostics-buffer error

From: João Távora <[email-masked]>
Date: Fri, 10 Apr 2020 17:16:47 +0100

On Fri, Apr 10, 2020 at 5:09 PM João Távora <[email-masked]> 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
index 25a2152f00..72171f5f8b 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1378,10 +1378,10 @@ flymake-show-diagnostics-buffer
          (source (current-buffer))
          (target (or (get-buffer name)
                      (with-current-buffer (get-buffer-create name)
+                       (setq flymake--diagnostics-buffer-source source)
                        (flymake-diagnostics-buffer-mode)
                        (current-buffer)))))
     (with-current-buffer target
-      (setq flymake--diagnostics-buffer-source source)
       (revert-buffer)
       (display-buffer (current-buffer)))))