From: Alan Mackenzie Date: Sun, 20 Oct 2019 16:55:26 +0000 (+0000) Subject: Optimize c-crosses-statement-barrier-p for large blocks of comment. X-Git-Tag: emacs-27.0.90~951 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=5ddbd8d191e7e38167a63728c6ead5a6401c63f6;p=emacs.git Optimize c-crosses-statement-barrier-p for large blocks of comment. This fixes bug #18134. * lisp/progmodes/cc-engine.el (c-crosses-statement-barrier-p): Give a limit to the c-backward-syntactic-ws which is searching for a virtual semicolon. In the main loop, Use c-forward-syntactic-ws to skip blocks of comments. --- diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 8d92b26ebd0..cceb58c290a 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -1468,10 +1468,14 @@ comment at the start of cc-engine.el for more info." (progn (if (setq lit-start (c-literal-start from)) ; Have we landed in a string/comment? (goto-char lit-start)) - (c-backward-syntactic-ws) ; ? put a limit here, maybe? + (c-backward-syntactic-ws (c-point 'bopl)) (setq vsemi-pos (point)) (c-at-vsemi-p)))) (throw 'done vsemi-pos)) + ;; Optimize for large blocks of comments. + ((progn (c-forward-syntactic-ws to) + (>= (point) to)) + (throw 'done nil)) ;; In a string/comment? ((setq lit-range (c-literal-limits from)) (goto-char (cdr lit-range)))