The order of entries in the keyword list is significant. Therefore, if you place your entries after those that highlight keywords and function declarations, they will not be matched.
(font-lock-add-keywords 'c-mode '(("\\(\\w+\\)\\s-*\(" (1 rumpsteak-font-lock-function-call-face))) t)
Alternatively, you can use a function instead of a regular expression like MATCHER . Overkill for your question, if you have precisely indicated your requirements, but are useful in more complex cases. Unchecked (typed directly in the browser, in fact, so I donโt even guarantee balanced parentheses).
(defun rumpsteak-match-function-call (&optional limit) (while (and (search-forward-regexp "\\(\\w+\\)\\s-*\(" limit 'no-error) (not (save-match-data (string-match c-keywords-regexp (match-string 1)))) (not (save-excursion (backward-char) (forward-sexp) (c-skip-whitespace-forward) (or (eobp) (= ?\{ (char-after (point))))))))) (font-lock-add-keywords 'c-mode '((rumpsteak-match-function-call (1 rumpsteak-font-lock-function-call-face))))
Gilles
source share