Function: flymake-show-diagnostic
flymake-show-diagnostic is an interactive and byte-compiled function
defined in flymake.el.gz.
Signature
(flymake-show-diagnostic POS &optional OTHER-WINDOW)
Documentation
Show location of diagnostic at POS.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
(defun flymake-show-diagnostic (pos &optional other-window)
"Show location of diagnostic at POS."
(interactive (list (point) t))
(let* ((id (or (tabulated-list-get-id pos)
(user-error "Nothing at point")))
(diag (plist-get id :diagnostic))
(locus (flymake--diag-locus diag))
(beg (flymake--diag-beg diag))
(end (flymake--diag-end diag))
(visit (lambda (b e)
(goto-char b)
(pulse-momentary-highlight-region (point)
(or e (line-end-position))
'highlight))))
(with-current-buffer (cond ((bufferp locus) locus)
(t (find-file-noselect locus)))
(with-selected-window
(display-buffer (current-buffer) other-window)
(cond (;; an annotated diagnostic (most common case), or a
;; non-annotated buffer diag
(number-or-marker-p beg)
(funcall visit beg end))
(;; a non-annotated file diag (TODO: could use `end'
;; here, too)
(pcase-let ((`(,bbeg . ,bend)
(flymake-diag-region (current-buffer)
(car beg)
(cdr beg))))
(funcall visit bbeg bend)))))
(current-buffer))))