Alan Mackenzie  committed e6f8eb0

Speed up fontification where there's large brace blocks.
cc-fonts.el (c-font-lock-enclosing-decls): Add a limit to a call of

  • Participants
  • Parent commits 0c31562
  • Branches default

Comments (0)

Files changed (1)

   ;; 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
       (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