Function: eca-editor--ensure-diagnostics-fresh
eca-editor--ensure-diagnostics-fresh is a natively compiled function
defined in eca-editor.el.
Signature
(eca-editor--ensure-diagnostics-fresh URI)
Documentation
Ensure diagnostics for URI are fresh.
Visits the buffer if needed, reverts if the file changed on disk, and waits for checkers to finish.
Source Code
;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-editor.el
(defun eca-editor--ensure-diagnostics-fresh (uri)
"Ensure diagnostics for URI are fresh.
Visits the buffer if needed, reverts if the file
changed on disk, and waits for checkers to finish."
(when uri
(let* ((file (eca--uri-to-path uri))
(buf (or (find-buffer-visiting file)
(find-file-noselect file))))
(with-current-buffer buf
;; Revert if file on disk is newer than buffer
(when (and (buffer-file-name)
(not (verify-visited-file-modtime buf)))
(revert-buffer t t t))
(font-lock-ensure)
(cond
;; lsp-mode: diagnostics are pushed async by
;; the server, we can only wait.
((bound-and-true-p lsp-mode)
(sit-for 2))
;; flycheck: trigger and poll for completion
((bound-and-true-p flycheck-mode)
(flycheck-buffer)
(eca-editor--wait-for-flycheck 3.0))
;; flymake: trigger and wait
((bound-and-true-p flymake-mode)
(flymake-start)
(sit-for 2))
;; fallback: wait for mode hooks to settle
(t
(sit-for 2)))))))