]> git.eshelyaron.com Git - emacs.git/commitdiff
Optimize c-crosses-statement-barrier-p for large blocks of comment.
authorAlan Mackenzie <acm@muc.de>
Sun, 20 Oct 2019 16:55:26 +0000 (16:55 +0000)
committerAlan Mackenzie <acm@muc.de>
Sun, 20 Oct 2019 16:55:26 +0000 (16:55 +0000)
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.

lisp/progmodes/cc-engine.el

index 8d92b26ebd04bf5a8f06542ad255153b787689ad..cceb58c290aeaf52038f74e0c5417c6ad568bc19 100644 (file)
@@ -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)))