summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-engine.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2019-06-16 15:46:12 +0000
committerAlan Mackenzie <acm@muc.de>2019-06-16 15:46:12 +0000
commite6fb9a443f48d7bcf1f56ce2ea526c3fa5b732b0 (patch)
treec310cacba31f57fad289bb0151b2dcc8048da759 /lisp/progmodes/cc-engine.el
parent98ba1c6b52898c5f72f2d6e5c845c8d9386f98f5 (diff)
downloademacs-e6fb9a443f48d7bcf1f56ce2ea526c3fa5b732b0.tar.gz
CC Mode: Remedy recent loss in performance
* lisp/progmodes/cc-engine.el (c-back-over-member-initializers): call c-parse-state outside of the narrowing operation. * lisp/progmodes/cc-fonts.el (c-get-fontification-context) (c-font-lock-cut-off-declarators): Replace calls to c-determine-limit with crude position calculations for speed.
Diffstat (limited to 'lisp/progmodes/cc-engine.el')
-rw-r--r--lisp/progmodes/cc-engine.el8
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 6598cc62c20..d3d7a1c5c0a 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -8611,10 +8611,11 @@ comment at the start of cc-engine.el for more info."
;; the function's arglist. Otherwise return nil, leaving point unchanged.
;; LIMIT, if non-nil, is a limit for the backward search.
(save-restriction
- (if limit (narrow-to-region limit (point)))
(let ((here (point))
- (paren-state (c-parse-state))
+ (paren-state (c-parse-state)) ; Do this outside the narrowing for
+ ; performance reasons.
pos level-plausible at-top-level res)
+ (if limit (narrow-to-region limit (point)))
;; Assume tentatively that we're at the top level. Try to go back to the
;; colon we seek.
(setq res
@@ -8637,7 +8638,8 @@ comment at the start of cc-engine.el for more info."
(while (and (not (and level-plausible
(setq at-top-level (c-at-toplevel-p))))
- (setq pos (c-pull-open-brace paren-state))) ; might be a paren.
+ (setq pos (c-pull-open-brace paren-state)) ; might be a paren.
+ (or (null limit) (>= pos limit)))
(setq level-plausible
(catch 'level
(goto-char pos)