aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2012-12-23 11:36:15 +0000
committerAlan Mackenzie2012-12-23 11:36:15 +0000
commit3f6b93cd7fa2b949e722408bcecf50e2b7b4322e (patch)
tree1b94aecd5e903716ea2a42e5164f64d0490d462b
parent173076b47b1e789fd34ed93374983e6542388096 (diff)
downloademacs-3f6b93cd7fa2b949e722408bcecf50e2b7b4322e.tar.gz
emacs-3f6b93cd7fa2b949e722408bcecf50e2b7b4322e.zip
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/ChangeLog6
-rw-r--r--lisp/progmodes/cc-fonts.el3
2 files changed, 8 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9de20493749..a0ae8fbc4f8 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12012-12-23 Alan Mackenzie <acm@muc.de>
2
3 Speed up fontification where there's large brace blocks.
4 * progmodes/cc-fonts.el (c-font-lock-enclosing-decls): Add a limit
5 to a call of c-beginning-of-decl-1.
6
12012-12-21 Chong Yidong <cyd@gnu.org> 72012-12-21 Chong Yidong <cyd@gnu.org>
2 8
3 * sort.el (sort-subr): Doc fix (Bug#13056). 9 * 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."
1591 ;; prevent a repeat invocation. See elisp/lispref page "Search-based 1591 ;; prevent a repeat invocation. See elisp/lispref page "Search-based
1592 ;; Fontification". 1592 ;; Fontification".
1593 (let* ((paren-state (c-parse-state)) 1593 (let* ((paren-state (c-parse-state))
1594 (decl-search-lim (c-determine-limit 1000))
1594 decl-context in-typedef ps-elt) 1595 decl-context in-typedef ps-elt)
1595 ;; Are we in any nested struct/union/class/etc. braces? 1596 ;; Are we in any nested struct/union/class/etc. braces?
1596 (while paren-state 1597 (while paren-state
@@ -1599,7 +1600,7 @@ casts and declarations are fontified. Used on level 2 and higher."
1599 (when (and (atom ps-elt) 1600 (when (and (atom ps-elt)
1600 (eq (char-after ps-elt) ?\{)) 1601 (eq (char-after ps-elt) ?\{))
1601 (goto-char ps-elt) 1602 (goto-char ps-elt)
1602 (setq decl-context (c-beginning-of-decl-1) 1603 (setq decl-context (c-beginning-of-decl-1 decl-search-lim)
1603 in-typedef (looking-at c-typedef-key)) 1604 in-typedef (looking-at c-typedef-key))
1604 (if in-typedef (c-forward-token-2)) 1605 (if in-typedef (c-forward-token-2))
1605 (when (and c-opt-block-decls-with-vars-key 1606 (when (and c-opt-block-decls-with-vars-key