Function: flymake--handle-report

flymake--handle-report is a byte-compiled function defined in flymake.el.gz.

Signature

(flymake--handle-report BACKEND TOKEN REPORT-ACTION &key EXPLANATION FORCE REGION &allow-other-keys)

Documentation

Handle reports from BACKEND identified by TOKEN.

BACKEND, REPORT-ACTION and EXPLANATION, and FORCE conform to the calling convention described in flymake-diagnostic-functions (which see). Optional FORCE says to handle a report even if TOKEN was not expected. REGION is a (BEG . END) pair of buffer positions indicating that this report applies to that region.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
(cl-defun flymake--handle-report
    (backend token report-action
             &key explanation force region
             &allow-other-keys)
  "Handle reports from BACKEND identified by TOKEN.
BACKEND, REPORT-ACTION and EXPLANATION, and FORCE conform to the
calling convention described in
`flymake-diagnostic-functions' (which see).  Optional FORCE says
to handle a report even if TOKEN was not expected.  REGION is
a (BEG . END) pair of buffer positions indicating that this
report applies to that region."
  (let ((state (or (gethash backend flymake--state)
                   (error "Can't find state for %s in `flymake--state'"
                          backend)))
        expected-token)
    (cond
     ((null state)
      (flymake-error
       "Unexpected report from unknown backend %s" backend))
     ((flymake--state-disabled state)
      (flymake-error
       "Unexpected report from disabled backend %s" backend))
     ((progn
        (setq expected-token (flymake--state-running state))
        (null expected-token))
      ;; should never happen
      (flymake-error "Unexpected report from stopped backend %s" backend))
     ((not (or (eq expected-token token)
               force))
      (flymake-error "Obsolete report from backend %s with explanation %s"
                     backend explanation))
     ((eq :panic report-action)
      (flymake--disable-backend backend explanation))
     ((not (listp report-action))
      (flymake--disable-backend backend
                                (format "Unknown action %S" report-action))
      (flymake-error "Expected report, but got unknown key %s" report-action))
     (t
      (flymake--publish-diagnostics report-action
                                    :backend backend
                                    :state state
                                    :region region)
      (when flymake-check-start-time
        (flymake-log :debug "backend %s reported %d diagnostics in %.2f second(s)"
                     backend
                     (length report-action)
                     (float-time
                      (time-since flymake-check-start-time))))))
    (setf (flymake--state-reported-p state) t)
    ;; All of the above might have touched the eol overlays, so issue
    ;; a call to update them.  But check running and reporting
    ;; backends first to flickering when multiple backends touch the
    ;; same eol overlays.
    (when (and flymake-show-diagnostics-at-end-of-line
               (not (cl-set-difference (flymake-running-backends)
                                       (flymake-reporting-backends))))
      (flymake--update-eol-overlays))
    (flymake--update-diagnostics-listings (current-buffer))))