diff options
author | Alan Mackenzie <acm@muc.de> | 2011-08-20 14:43:33 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2011-08-20 14:43:33 +0000 |
commit | b128268e4491e93c332d14c8ae92646ab5884fba (patch) | |
tree | af506d5207b59595c94fb8d6afcde9422aa9e0ae /lisp/progmodes/cc-langs.el | |
parent | 11994f9ba68c3607edb86e86d86e554abe2f955c (diff) | |
download | emacs-b128268e4491e93c332d14c8ae92646ab5884fba.tar.gz |
Fontify CPP expressions correctly when starting in the middle of such a
construct. Mainly for when jit-lock etc. starts a chunk here.
cc-fonts.el (c-font-lock-context): new buffer local variable.
(c-make-font-lock-search-form): new function, extracted from
c-make-font-lock-search-function.
(c-make-font-lock-search-function): Use the above function.
(c-make-font-lock-context-search-function): New function.
(c-cpp-matchers): Enhance the preprocessor expression case with the above
function
(c-font-lock-complex-decl-prepare): Test for being in a CPP form which
takes an expression.
cc-langs.el (c-cpp-expr-intro-re): New lang-variable.
Diffstat (limited to 'lisp/progmodes/cc-langs.el')
-rw-r--r-- | lisp/progmodes/cc-langs.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 35097242cb7..153ef0880c7 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -815,6 +815,16 @@ expression." t (if (c-lang-const c-opt-cpp-prefix) '("if" "elif"))) +(c-lang-defconst c-cpp-expr-intro-re + "Regexp which matches the start of a CPP directive which contains an +expression, or nil if there aren't any in the language." + t (if (c-lang-const c-cpp-expr-directives) + (concat + (c-lang-const c-opt-cpp-prefix) + (c-make-keywords-re t (c-lang-const c-cpp-expr-directives))))) +(c-lang-defvar c-cpp-expr-intro-re + (c-lang-const c-cpp-expr-intro-re)) + (c-lang-defconst c-cpp-expr-functions "List of functions in cpp expressions." t (if (c-lang-const c-opt-cpp-prefix) |