Function: cwarn-font-lock-match
cwarn-font-lock-match is a macro defined in cwarn.el.gz.
Signature
(cwarn-font-lock-match RE &rest BODY)
Documentation
Match RE but only if BODY holds.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/cwarn.el.gz
;;}}}
;;{{{ Font-lock keywords and match functions
;; This section contains font-lock keywords. A font lock keyword can
;; either contain a regular expression or a match function. All
;; keywords defined here use match functions since the C and C++
;; constructions highlighted by CWarn are too complex to be matched by
;; regular expressions.
;;
;; A match function should act like a normal forward search. They
;; should return non-nil if they found a candidate and the match data
;; should correspond to the highlight part of the font-lock keyword.
;; The functions should not generate errors, in that case font-lock
;; will fail to highlight the buffer. A match function takes one
;; argument, LIMIT, that represent the end of area to be searched.
;;
;; The variable `cwarn-font-lock-feature-keywords-alist' contains a
;; mapping from CWarn features to the font-lock keywords defined
;; below.
(defmacro cwarn-font-lock-match (re &rest body)
"Match RE but only if BODY holds."
`(let ((res nil))
(while
(progn
(setq res (re-search-forward ,re limit t))
(and res
(save-excursion
(when (match-beginning 1) (goto-char (match-beginning 1)))
(condition-case nil ; In case something barfs.
(not (save-match-data
,@body))
(error t))))))
res))