Function: flymake-diagnostic-text

flymake-diagnostic-text is a byte-compiled function defined in flymake.el.gz.

Signature

(flymake-diagnostic-text DIAG &optional (PARTS '(origin code message)))

Documentation

Describe diagnostic DIAG's as a string.

PARTS says which parts of the diagnostic to include. It is a list of symbols as described in flymake-diagnostic-format-alist (which see). PARTS defaults to (origin code message).

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
(cl-defun flymake-diagnostic-text (diag
                                   &optional (parts '(origin code message)))
  "Describe diagnostic DIAG's as a string.
PARTS says which parts of the diagnostic to include.  It is a list of
symbols as described in `flymake-diagnostic-format-alist' (which see).
PARTS defaults to `(origin code message)'."
  (let* ((w parts)
         (a (and (memq 'origin w) (flymake--diag-origin diag)))
         (b (and (memq 'code w) (flymake--diag-code diag)))
         (c (cond ((memq 'message w) (flymake--diag-message diag))
                  ((memq 'oneliner w)
                   (let* ((msg (flymake--diag-message diag)))
                     (substring msg 0 (cl-loop for i from 0 for a across msg
                                               when (eq a ?\n) return i)))))))
    (concat a
            (when (and a b) " ")
            (when b (concat "[" b "]"))
            (when (and c (or a b)) ": ")
            c)))