Function: flymake--project-diagnostics
flymake--project-diagnostics is a byte-compiled function defined in
flymake.el.gz.
Signature
(flymake--project-diagnostics &optional (PROJECT (project-current)))
Documentation
Get all known relevant diagnostics for PROJECT.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
(cl-defun flymake--project-diagnostics (&optional (project (project-current)))
"Get all known relevant diagnostics for PROJECT."
(let* ((root (project-root project))
(visited-buffers (cl-remove-if-not #'buffer-file-name (project-buffers project)))
buffer-annotated-diags
relevant-foreign-diags
list-only-diags
annotated-diag-files)
(setq buffer-annotated-diags
(cl-loop for buf in visited-buffers
for diags = (with-current-buffer buf
(flymake-diagnostics))
when diags do
(push (buffer-file-name buf) annotated-diag-files)
append (cl-sort diags #'< :key #'flymake-diagnostic-beg)))
(cl-loop
for buf in visited-buffers
do (with-current-buffer buf
(when (and flymake-mode flymake--state)
(maphash
(lambda (_backend state)
(maphash
(lambda (foreign-file diags)
(setq foreign-file (expand-file-name foreign-file))
;; FIXME: This is not right if more than one visited
;; source targets the same foreign file. Don't
;; think we can get away without some kind of
;; `cl-remove-duplicates' here that utilizes
;; `flymake--equal-diagnostic-p'.
(unless (member foreign-file annotated-diag-files)
(push foreign-file annotated-diag-files)
(setq relevant-foreign-diags
(append relevant-foreign-diags
diags))))
(flymake--state-foreign-diags state)))
flymake--state))))
(setq list-only-diags
(cl-loop for (file-name . diags) in flymake-list-only-diagnostics
if (and (string-prefix-p (expand-file-name root) file-name)
(not (member file-name annotated-diag-files)))
append diags))
(append buffer-annotated-diags relevant-foreign-diags list-only-diags)))