emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 5ddbd8d: Optimize c-crosses-statement-barrier-p for


From: Alan Mackenzie
Subject: [Emacs-diffs] master 5ddbd8d: Optimize c-crosses-statement-barrier-p for large blocks of comment.
Date: Sun, 20 Oct 2019 12:58:27 -0400 (EDT)

branch: master
commit 5ddbd8d191e7e38167a63728c6ead5a6401c63f6
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    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.
---
 lisp/progmodes/cc-engine.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 8d92b26..cceb58c 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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]