diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index f99b821..ea347ea 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog @@ -1,3 +1,8 @@ +2013-04-16 Eduard Wiebe + + * flymake.texi (Parsing the output, Customizable variables): Add + reference to `flymake-warning-predicate'. + 2013-04-15 Michael Albinus * tramp.texi (Frequently Asked Questions): New item for diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 5dedda1..7196eed 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -311,6 +311,9 @@ Used when looking for a master file. @xref{Locating a master file}. Patterns for error/warning messages in the form @code{(regexp file-idx line-idx col-idx err-text-idx)}. @xref{Parsing the output}. +@item flymake-warning-predicate +Predicate to classify error text as warning. @xref{Parsing the output}. + @item flymake-compilation-prevents-syntax-check A flag indicating whether compilation and syntax check of the same file cannot be run simultaneously. @@ -706,7 +709,10 @@ list of items of the form @code{(regexp file-idx line-idx err-text-idx)}, used to determine whether a particular line is an error message and extract file name, line number and error text, respectively. Error type (error/warning) is also guessed by matching -error text with the '@code{^[wW]arning}' pattern. Anything that was not +error text with the @code{flymake-warning-predicate} predicate. The +predicate is either a regular expression, default @code{"[wW]arning"}, +or a function. When the predicate is a function, it takes error text +as argument and returns a non-nil for a warning. Anything that was not classified as a warning is considered an error. Type is then used to sort error menu items, which shows error messages first. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 81868e8..f8cb826 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2013-04-15 Eduard Wiebe + + Extend flymakes warning predicate. + + * progmodes/flymake.el (flymake-warning-predicate): New. + (flymake-parse-line): Use it. + (flymake-warning-re): Make obsolete alias to + `flymake-warning-predicate'. + 2013-04-15 Stefan Monnier * minibuffer.el (minibuffer-complete): Don't just scroll diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 0f92df9..905ad49 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -1002,8 +1002,13 @@ from compile.el") ;; :type '(repeat (string number number number)) ;;) -(defvar flymake-warning-re "^[wW]arning" - "Regexp matching against err-text to detect a warning.") +(define-obsolete-variable-alias 'flymake-warning-re 'flymake-warning-predicate "24.4") +(defcustom flymake-warning-predicate "^[wW]arning" + "Predicate matching against error text to detect a warning." + :group 'flymake + :version "24.4" + :type '(choice (regexp :tag "Regexp predicate") + (function :tag "Function predicate"))) (defun flymake-parse-line (line) "Parse LINE to see if it is an error or warning. @@ -1024,10 +1029,13 @@ Return its components if so, nil otherwise." (setq err-text (if (> (length (car patterns)) 4) (match-string (nth 4 (car patterns)) line) (flymake-patch-err-text (substring line (match-end 0))))) - (or err-text (setq err-text "")) - (if (and err-text (string-match flymake-warning-re err-text)) - (setq err-type "w") - ) + (if (null err-text) + (setq err-text "") + (when (cond ((stringp flymake-warning-predicate) + (string-match flymake-warning-predicate err-text)) + ((functionp flymake-warning-predicate) + (funcall flymake-warning-predicate err-text))) + (setq err-type "w"))) (flymake-log 3 "parse line: file-idx=%s line-idx=%s file=%s line=%s text=%s" file-idx line-idx raw-file-name line-no err-text) (setq matched t))) diff --git a/test/ChangeLog b/test/ChangeLog index bf68984..21e2f16 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,12 @@ +2013-04-15 Eduard Wiebe + + Test suite for flymake. + + * automated/flymake-tests.el: + * automated/flymake/warnpred/Makefile + * automated/flymake/warnpred/test.c + * automated/flymake/warnpred/test.pl: New files. + 2013-04-09 Masatake YAMATO * automated/add-log-tests.el: New file. (Bug#14112)