diff options
author | Alan Mackenzie <acm@muc.de> | 2011-12-13 18:47:08 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2011-12-13 18:47:08 +0000 |
commit | 13d49cbb266f0ead789944508ad0872129885609 (patch) | |
tree | a8515a60dfcd07275049cf07cc2ad9d68e2ad5dc /lisp/progmodes/cc-fonts.el | |
parent | 15e0efc7dc8e01b9416def38bc1f18fdabe70256 (diff) | |
download | emacs-13d49cbb266f0ead789944508ad0872129885609.tar.gz |
Large brace-block initialisation makes CC Mode slow: Fix.
Tidy up and accelerate c-in-literal, etc. by using the c-parse-state
routines. Limit backward searching in c-font-lock-enclosing.decl.
cc-engine.el (c-state-pp-to-literal): Return the pp-state and literal
type in addition to the limits.
(c-state-safe-place): New defun, extracted from c-state-literal-at.
(c-state-literal-at): Use the above new defun.
(c-slow-in-literal, c-fast-in-literal): Removed.
(c-in-literal, c-literal-limits): Amended to use c-state-pp-to-literal.
cc-fonts.el (c-font-lock-enclosing-decls): Check for being in a literal.
Add a limit for backward searching.
cc-mode.el (awk-mode): Don't alias c-in-literal to c-slow-in-literal.
Diffstat (limited to 'lisp/progmodes/cc-fonts.el')
-rw-r--r-- | lisp/progmodes/cc-fonts.el | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index c18789de07b..c6c8bd107f6 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1539,10 +1539,11 @@ casts and declarations are fontified. Used on level 2 and higher." ;; Fontification". (let* ((paren-state (c-parse-state)) (start (point)) + (bod-lim (max (- (point) 500) (point-min))) decl-context bo-decl in-typedef type-type ps-elt) ;; First, are we actually in a "local" declaration? - (setq decl-context (c-beginning-of-decl-1) + (setq decl-context (c-beginning-of-decl-1 bod-lim) bo-decl (point) in-typedef (looking-at c-typedef-key)) (if in-typedef (c-forward-token-2)) |