unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "João Távora" <joaotavora@gmail.com>
Cc: 40529@debbugs.gnu.org, nadiasggeb001@gmail.com
Subject: bug#40529: 26.3; global-display-line-numbers-mode and flymake-show-diagnostics-buffer error
Date: Sun, 12 Apr 2020 20:15:08 +0300	[thread overview]
Message-ID: <83wo6kk4mb.fsf@gnu.org> (raw)
In-Reply-To: <CALDnm52UAeXwT58vHMDy0FeqZJXFB3KKP1EEiUsue6yAC1Sa0g@mail.gmail.com> (message from João Távora on Sun, 12 Apr 2020 17:58:16 +0100)

> From: João Távora <joaotavora@gmail.com>
> Date: Sun, 12 Apr 2020 17:58:16 +0100
> Cc: Aidan Beggs <nadiasggeb001@gmail.com>, 40529@debbugs.gnu.org
> 
> > I'm sure a simple solution for Flymake can be found.  E.g., what about
> > skipping the entire body of flymake--diagnostics-buffer-entries if
> > flymake--diagnostics-buffer-source is nil
> 
> Maybe that works, yes. Feel free to try it and commit it 
> to Emacs 27, I have little time and I'm booted into a machine 
> with no Emacs.

OK.

Aidan, can you try the patch below and see if it solves the problem?
The initial error in the recipe you posted is definitely gone after
applying the patch, but please also try this after that and see that
flymake-show-diagnostics-buffer also works after that, in real-life
use.

Thanks.

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 25a2152..b37b72e 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1321,35 +1321,36 @@ flymake-goto-diagnostic
    (flymake-show-diagnostic (if (button-type pos) (button-start pos) pos))))
 
 (defun flymake--diagnostics-buffer-entries ()
-  (with-current-buffer flymake--diagnostics-buffer-source
-    (cl-loop for diag in
-             (cl-sort (flymake-diagnostics) #'< :key #'flymake-diagnostic-beg)
-             for (line . col) =
-             (save-excursion
-               (goto-char (flymake--diag-beg diag))
-               (cons (line-number-at-pos)
-                     (- (point)
-                        (line-beginning-position))))
-             for type = (flymake--diag-type diag)
-             collect
-             (list (list :diagnostic diag
-                         :line line
-                         :severity (flymake--lookup-type-property
-                                    type
-                                    'severity (warning-numeric-level :error)))
-                   `[,(format "%s" line)
-                     ,(format "%s" col)
-                     ,(propertize (format "%s"
-                                          (flymake--lookup-type-property
-                                           type 'flymake-type-name type))
-                                  'face (flymake--lookup-type-property
-                                         type 'mode-line-face 'flymake-error))
-                     (,(format "%s" (flymake--diag-text diag))
-                      mouse-face highlight
-                      help-echo "mouse-2: visit this diagnostic"
-                      face nil
-                      action flymake-goto-diagnostic
-                      mouse-action flymake-goto-diagnostic)]))))
+  (when (bufferp flymake--diagnostics-buffer-source)
+    (with-current-buffer flymake--diagnostics-buffer-source
+      (cl-loop for diag in
+               (cl-sort (flymake-diagnostics) #'< :key #'flymake-diagnostic-beg)
+               for (line . col) =
+               (save-excursion
+                 (goto-char (flymake--diag-beg diag))
+                 (cons (line-number-at-pos)
+                       (- (point)
+                          (line-beginning-position))))
+               for type = (flymake--diag-type diag)
+               collect
+               (list (list :diagnostic diag
+                           :line line
+                           :severity (flymake--lookup-type-property
+                                      type
+                                      'severity (warning-numeric-level :error)))
+                     `[,(format "%s" line)
+                       ,(format "%s" col)
+                       ,(propertize (format "%s"
+                                            (flymake--lookup-type-property
+                                             type 'flymake-type-name type))
+                                    'face (flymake--lookup-type-property
+                                           type 'mode-line-face 'flymake-error))
+                       (,(format "%s" (flymake--diag-text diag))
+                        mouse-face highlight
+                        help-echo "mouse-2: visit this diagnostic"
+                        face nil
+                        action flymake-goto-diagnostic
+                        mouse-action flymake-goto-diagnostic)])))))
 
 (define-derived-mode flymake-diagnostics-buffer-mode tabulated-list-mode
   "Flymake diagnostics"





  reply	other threads:[~2020-04-12 17:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 20:55 bug#40529: 26.3; global-display-line-numbers-mode and flymake-show-diagnostics-buffer error Aidan Beggs
2020-04-10  6:30 ` Eli Zaretskii
2020-04-10 11:50   ` João Távora
2020-04-10 12:16     ` Eli Zaretskii
2020-04-10 14:38       ` João Távora
2020-04-10 15:50         ` Eli Zaretskii
2020-04-10 16:09           ` João Távora
2020-04-10 16:16             ` João Távora
2020-04-12 12:22               ` João Távora
2020-04-12 13:43                 ` Eli Zaretskii
2020-04-12 14:13                   ` João Távora
2020-04-12 14:42                     ` Eli Zaretskii
2020-04-12 16:58                       ` João Távora
2020-04-12 17:15                         ` Eli Zaretskii [this message]
2020-04-12 20:45                           ` Aidan Beggs
2020-04-13  5:03                             ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83wo6kk4mb.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=40529@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=nadiasggeb001@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).