Function: flymake-make-diagnostic

flymake-make-diagnostic is an autoloaded and byte-compiled function defined in flymake.el.gz.

Signature

(flymake-make-diagnostic LOCUS BEG END TYPE INFO &optional DATA OVERLAY-PROPERTIES)

Documentation

Make a Flymake diagnostic for LOCUS's region from BEG to END.

LOCUS is a buffer object or a string designating a file name.

TYPE is a diagnostic symbol (see Info Node (Flymake)Flymake error types)

INFO is a description of the problem detected. It may be a string, or list (ORIGIN CODE MESSAGE) appropriately categorizing and describing the diagnostic. ORIGIN may be a string or nil. CODE maybe be a string, a number or nil. MESSAGE must be a string.

DATA is any object that the caller wishes to attach to the created diagnostic for later retrieval with flymake-diagnostic-data.

If LOCUS is a buffer, BEG and END should be buffer positions inside it. If LOCUS designates a file, BEG and END should be a cons (LINE . COL) indicating a file position. In this second case, END may be omitted in which case the region is computed using flymake-diag-region if the diagnostic is appended to an actual buffer.

OVERLAY-PROPERTIES is an alist of properties attached to the created diagnostic, overriding the default properties and any properties listed in the flymake-overlay-control property of the diagnostic's type symbol.

Probably introduced at or before Emacs version 31.1.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/flymake.el.gz
;;;###autoload
(defun flymake-make-diagnostic (locus
                                beg
                                end
                                type
                                info
                                &optional data
                                overlay-properties)
  "Make a Flymake diagnostic for LOCUS's region from BEG to END.
LOCUS is a buffer object or a string designating a file name.

TYPE is a diagnostic symbol (see Info Node `(Flymake)Flymake error
types')

INFO is a description of the problem detected.  It may be a string, or
list (ORIGIN CODE MESSAGE) appropriately categorizing and describing the
diagnostic.  ORIGIN may be a string or nil.  CODE maybe be a string, a
number or nil.  MESSAGE must be a string.

DATA is any object that the caller wishes to attach to the created
diagnostic for later retrieval with `flymake-diagnostic-data'.

If LOCUS is a buffer, BEG and END should be buffer positions inside it.
If LOCUS designates a file, BEG and END should be a cons (LINE . COL)
indicating a file position.  In this second case, END may be omitted in
which case the region is computed using `flymake-diag-region' if the
diagnostic is appended to an actual buffer.

OVERLAY-PROPERTIES is an alist of properties attached to the created
diagnostic, overriding the default properties and any properties listed
in the `flymake-overlay-control' property of the diagnostic's type
symbol."
  (when (stringp locus)
    (setq locus (expand-file-name locus)))
  (cond ((stringp info)
         (setq info (list nil nil info)))
        ((numberp (cadr info))
         (setf (cadr info) (number-to-string (cadr info)))))
  (flymake--diag-make :locus locus :beg beg :end end
                      :type type :origin (car info) :code (cadr info)
                      :message (caddr info) :data data
                      :overlay-properties overlay-properties
                      :orig-beg beg
                      :orig-end end))