diff options
author | Alan Mackenzie <acm@muc.de> | 2012-12-23 11:36:15 +0000 |
---|---|---|
committer | Alan Mackenzie <acm@muc.de> | 2012-12-23 11:36:15 +0000 |
commit | 74f4f020494557c8e1561916bc739288cebab096 (patch) | |
tree | a3bf2bc305b3221a720e0686b1c6c6c1908f0350 | |
parent | 9dab7d50faabe9727965c25a4edf5329f41b6bb4 (diff) | |
download | emacs-74f4f020494557c8e1561916bc739288cebab096.tar.gz |
Speed up fontification where there's large brace blocks.
progmodes/cc-fonts.el (c-font-lock-enclosing-decls): Add a limit to a
call of c-beginning-of-decl-1.
-rw-r--r-- | lisp/ChangeLog | 6 | ||||
-rw-r--r-- | lisp/progmodes/cc-fonts.el | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 78bd11dbf88..f0cea8ec509 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-12-23 Alan Mackenzie <acm@muc.de> + + Speed up fontification where there's large brace blocks. + * progmodes/cc-fonts.el (c-font-lock-enclosing-decls): Add a limit + to a call of c-beginning-of-decl-1. + 2012-12-21 Chong Yidong <cyd@gnu.org> * sort.el (sort-subr): Doc fix (Bug#13056). diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 2d116e1ecdc..c29e2220211 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el @@ -1591,6 +1591,7 @@ casts and declarations are fontified. Used on level 2 and higher." ;; prevent a repeat invocation. See elisp/lispref page "Search-based ;; Fontification". (let* ((paren-state (c-parse-state)) + (decl-search-lim (c-determine-limit 1000)) decl-context in-typedef ps-elt) ;; Are we in any nested struct/union/class/etc. braces? (while paren-state @@ -1599,7 +1600,7 @@ casts and declarations are fontified. Used on level 2 and higher." (when (and (atom ps-elt) (eq (char-after ps-elt) ?\{)) (goto-char ps-elt) - (setq decl-context (c-beginning-of-decl-1) + (setq decl-context (c-beginning-of-decl-1 decl-search-lim) in-typedef (looking-at c-typedef-key)) (if in-typedef (c-forward-token-2)) (when (and c-opt-block-decls-with-vars-key |