Fix 'flymake-show-diagnostics-buffer' when line numbers are displayed
* lisp/progmodes/flymake.el (flymake--diagnostics-buffer-entries): Do nothing if 'flymake--diagnostics-buffer-source' is not a buffer. (Bug#40529)
This commit is contained in:
parent
63e8d0ea87
commit
ff09b4eeac
1 changed files with 36 additions and 29 deletions
|
@ -1321,35 +1321,42 @@ POS can be a buffer position or a button"
|
||||||
(flymake-show-diagnostic (if (button-type pos) (button-start pos) pos))))
|
(flymake-show-diagnostic (if (button-type pos) (button-start pos) pos))))
|
||||||
|
|
||||||
(defun flymake--diagnostics-buffer-entries ()
|
(defun flymake--diagnostics-buffer-entries ()
|
||||||
(with-current-buffer flymake--diagnostics-buffer-source
|
;; Do nothing if 'flymake--diagnostics-buffer-source' has not yet
|
||||||
(cl-loop for diag in
|
;; been set to a valid buffer. This could happen when this function
|
||||||
(cl-sort (flymake-diagnostics) #'< :key #'flymake-diagnostic-beg)
|
;; is called too early. For example 'global-display-line-numbers-mode'
|
||||||
for (line . col) =
|
;; calls us from its mode hook, when the diagnostic buffer has just
|
||||||
(save-excursion
|
;; been created by 'flymake-show-diagnostics-buffer', but is not yet
|
||||||
(goto-char (flymake--diag-beg diag))
|
;; set up properly.
|
||||||
(cons (line-number-at-pos)
|
(when (bufferp flymake--diagnostics-buffer-source)
|
||||||
(- (point)
|
(with-current-buffer flymake--diagnostics-buffer-source
|
||||||
(line-beginning-position))))
|
(cl-loop for diag in
|
||||||
for type = (flymake--diag-type diag)
|
(cl-sort (flymake-diagnostics) #'< :key #'flymake-diagnostic-beg)
|
||||||
collect
|
for (line . col) =
|
||||||
(list (list :diagnostic diag
|
(save-excursion
|
||||||
:line line
|
(goto-char (flymake--diag-beg diag))
|
||||||
:severity (flymake--lookup-type-property
|
(cons (line-number-at-pos)
|
||||||
type
|
(- (point)
|
||||||
'severity (warning-numeric-level :error)))
|
(line-beginning-position))))
|
||||||
`[,(format "%s" line)
|
for type = (flymake--diag-type diag)
|
||||||
,(format "%s" col)
|
collect
|
||||||
,(propertize (format "%s"
|
(list (list :diagnostic diag
|
||||||
(flymake--lookup-type-property
|
:line line
|
||||||
type 'flymake-type-name type))
|
:severity (flymake--lookup-type-property
|
||||||
'face (flymake--lookup-type-property
|
type
|
||||||
type 'mode-line-face 'flymake-error))
|
'severity (warning-numeric-level :error)))
|
||||||
(,(format "%s" (flymake--diag-text diag))
|
`[,(format "%s" line)
|
||||||
mouse-face highlight
|
,(format "%s" col)
|
||||||
help-echo "mouse-2: visit this diagnostic"
|
,(propertize (format "%s"
|
||||||
face nil
|
(flymake--lookup-type-property
|
||||||
action flymake-goto-diagnostic
|
type 'flymake-type-name type))
|
||||||
mouse-action flymake-goto-diagnostic)]))))
|
'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
|
(define-derived-mode flymake-diagnostics-buffer-mode tabulated-list-mode
|
||||||
"Flymake diagnostics"
|
"Flymake diagnostics"
|
||||||
|
|
Loading…
Add table
Reference in a new issue