Fix C++ fontification problems 500 bytes after typing a space, and other bugs
commitef7df187eb0b631a6909bdc02f82b3dfef0ad689
authorAlan Mackenzie <acm@muc.de>
Thu, 30 Mar 2017 20:24:39 +0000 (30 20:24 +0000)
committerAlan Mackenzie <acm@muc.de>
Thu, 30 Mar 2017 20:24:39 +0000 (30 20:24 +0000)
treee37b293633b0d65f3ea2f21125021ae99bf0dc92
parent6ff870218dd4bc015cc4115ceb2febd8d807e57c
Fix C++ fontification problems 500 bytes after typing a space, and other bugs

Also implement the "asymmetric space" rule for fontifying otherwise
ambiguous
declarations/expressions.

* lisp/progmodes/cc-engine.el (c-before-change-check-<>-operators): Don't set
c-new-BEG or c-new-END when there is no need.
(c-forward-decl-or-cast-1): Add "CASE 17.5" to implement the "asymmetric
space" rule.

* lisp/progmodes/cc-fonts.el (c-get-fontification-context): New function,
extracted from c-font-lock-declarations.  Add to this function processing to
make `context' 'decl for lines contained within parens when these are also
declarations.
(c-font-lock-declarations): Call the newly extracted function above in place
of inline code.

* lisp/progmodes/cc-mode.el (c-fl-decl-start): Set point before calling
c-literal-start.

* lisp/progmodes/cc-vars.el (c-asymmetry-fontification-flag): New user option.

* doc/misc/cc-mode.texi (Misc Font Locking): New node documenting the new
"asymmetric fontification" rule, including the variable
c-asymmetric-fontification-flag.
doc/misc/cc-mode.texi
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-fonts.el
lisp/progmodes/cc-mode.el
lisp/progmodes/cc-vars.el