Variable: compilation-error-regexp-alist

compilation-error-regexp-alist is a customizable variable defined in compile.el.gz.

Value

(cider less-css absoft ada aix ant bash borland python-tracebacks-and-caml cmake cmake-info comma msft edg-1 edg-2 epc ftnchek gradle-kotlin iar ibm irix java javac jikes-file maven jikes-line clang-include gcc-include ruby-Test::Unit gmake gnu cucumber lcc makepp mips-1 mips-2 omake oracle perl php rxp shellcheck sparc-pascal-file sparc-pascal-line sparc-pascal-example sun sun-ada watcom 4bsd gcov-file gcov-header gcov-nomark gcov-called-line gcov-never-called perl--Pod::Checker perl--Test perl--Test2 perl--Test::Harness weblint guile-file guile-line)

Documentation

Alist that specifies how to match errors in compiler output.

On GNU and Unix, any string is a valid filename, so these matchers must make some common sense assumptions, which catch normal cases. A shorter list will be lighter on resource usage.

Instead of an alist element, you can use a symbol, which is looked up in compilation-error-regexp-alist-alist. You can see the predefined symbols and their effects in the file etc/compilation.txt (linked below if you are customizing this).

Each elt has the form (REGEXP FILE [LINE COLUMN TYPE HYPERLINK HIGHLIGHT...]). If REGEXP matches, the FILE'th subexpression gives the file name, and the LINE'th subexpression gives the line number. The COLUMN'th subexpression gives the column number on that line.

If FILE, LINE or COLUMN are nil or that index didn't match, that information is not present on the matched line. In that case the file name is assumed to be the same as the previous one in the buffer, line number defaults to 1 and column defaults to beginning of line's indentation.

FILE can also have the form (FILE FORMAT...), where the FORMATs
(e.g. "%s.c") will be applied in turn to the recognized file
name, until a file of that name is found. Or FILE can also be a function that returns (FILENAME) or (RELATIVE-FILENAME . DIRNAME). In the former case, FILENAME may be relative or absolute, or it may be a buffer.

LINE can also be of the form (LINE . END-LINE) meaning a range of lines. COLUMN can also be of the form (COLUMN . END-COLUMN) meaning a range of columns starting on LINE and ending on END-LINE, if that matched.

LINE, END-LINE, COL, and END-COL can also be functions of no argument that return the corresponding line or column number. They can assume REGEXP has just been matched, and should correspondingly preserve this match data.

TYPE is 2 or nil for a real error or 1 for warning or 0 for info. TYPE can also be of the form (WARNING . INFO). In that case this will be equivalent to 1 if the WARNING'th subexpression matched or else equivalent to 0 if the INFO'th subexpression matched, or else equivalent to 2 if neither of them matched. See compilation-error-face, compilation-warning-face, compilation-info-face and compilation-skip-threshold.

What matched the HYPERLINK'th subexpression has mouse-face and compilation-message-face applied. If this is nil, the text matched by the whole REGEXP becomes the hyperlink.

Additional HIGHLIGHTs take the shape (SUBMATCH FACE), where SUBMATCH is the number of a submatch and FACE is an expression which evaluates to a face name (a symbol or string). Alternatively, FACE can evaluate to a property list of the form (face FACE PROP1 VAL1 PROP2 VAL2 ...), in which case all the listed text properties PROP# are given values VAL# as well.

After identifying errors and warnings determined by this variable, the compilation-transform-file-match-alist variable is then consulted. It allows further transformations of the matched file names, and weeding out false positives.

Probably introduced at or before Emacs version 22.1.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/compile.el.gz
(defcustom compilation-error-regexp-alist
  (mapcar #'car compilation-error-regexp-alist-alist)
  "Alist that specifies how to match errors in compiler output.
On GNU and Unix, any string is a valid filename, so these
matchers must make some common sense assumptions, which catch
normal cases.  A shorter list will be lighter on resource usage.

Instead of an alist element, you can use a symbol, which is
looked up in `compilation-error-regexp-alist-alist'.  You can see
the predefined symbols and their effects in the file
`etc/compilation.txt' (linked below if you are customizing this).

Each elt has the form (REGEXP FILE [LINE COLUMN TYPE HYPERLINK
HIGHLIGHT...]).  If REGEXP matches, the FILE'th subexpression
gives the file name, and the LINE'th subexpression gives the line
number.  The COLUMN'th subexpression gives the column number on
that line.

If FILE, LINE or COLUMN are nil or that index didn't match, that
information is not present on the matched line.  In that case the
file name is assumed to be the same as the previous one in the
buffer, line number defaults to 1 and column defaults to
beginning of line's indentation.

FILE can also have the form (FILE FORMAT...), where the FORMATs
\(e.g. \"%s.c\") will be applied in turn to the recognized file
name, until a file of that name is found.  Or FILE can also be a
function that returns (FILENAME) or (RELATIVE-FILENAME . DIRNAME).
In the former case, FILENAME may be relative or absolute, or it may
be a buffer.

LINE can also be of the form (LINE . END-LINE) meaning a range
of lines.  COLUMN can also be of the form (COLUMN . END-COLUMN)
meaning a range of columns starting on LINE and ending on
END-LINE, if that matched.

LINE, END-LINE, COL, and END-COL can also be functions of no argument
that return the corresponding line or column number.  They can assume REGEXP
has just been matched, and should correspondingly preserve this match data.

TYPE is 2 or nil for a real error or 1 for warning or 0 for info.
TYPE can also be of the form (WARNING . INFO).  In that case this
will be equivalent to 1 if the WARNING'th subexpression matched
or else equivalent to 0 if the INFO'th subexpression matched,
or else equivalent to 2 if neither of them matched.
See `compilation-error-face', `compilation-warning-face',
`compilation-info-face' and `compilation-skip-threshold'.

What matched the HYPERLINK'th subexpression has `mouse-face' and
`compilation-message-face' applied.  If this is nil, the text
matched by the whole REGEXP becomes the hyperlink.

Additional HIGHLIGHTs take the shape (SUBMATCH FACE), where
SUBMATCH is the number of a submatch and FACE is an expression
which evaluates to a face name (a symbol or string).
Alternatively, FACE can evaluate to a property list of the
form (face FACE PROP1 VAL1 PROP2 VAL2 ...), in which case all the
listed text properties PROP# are given values VAL# as well.

After identifying errors and warnings determined by this
variable, the `compilation-transform-file-match-alist' variable
is then consulted.  It allows further transformations of the
matched file names, and weeding out false positives."
  :type '(repeat (choice (symbol :tag "Predefined symbol")
			 (sexp :tag "Error specification")))
  :link `(file-link :tag "example file"
		    ,(expand-file-name "compilation.txt" data-directory)))