GNU bug report logs -
#40529
26.3; global-display-line-numbers-mode and flymake-show-diagnostics-buffer error
Previous Next
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 #47 received at 40529 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
That patch seems to do the trick for me. I don't make particularly
extensive use of the flymake diagnostics buffer, but for regular use it
seems to work as expected.
Thanks,
Aidan
On Sun, Apr 12, 2020 at 1:15 PM Eli Zaretskii <eliz <at> gnu.org> wrote:
> > From: João Távora <joaotavora <at> gmail.com>
> > Date: Sun, 12 Apr 2020 17:58:16 +0100
> > Cc: Aidan Beggs <nadiasggeb001 <at> gmail.com>, 40529 <at> 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"
[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.