diff options
| author | Alan Mackenzie | 2019-10-20 16:55:26 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2019-10-20 16:55:26 +0000 |
| commit | 5ddbd8d191e7e38167a63728c6ead5a6401c63f6 (patch) | |
| tree | 4d117995d63b4912d9aa3d150cce4ff196a864d1 | |
| parent | dff8978f5004561e2625b4199cefd8c262bb42cb (diff) | |
| download | emacs-5ddbd8d191e7e38167a63728c6ead5a6401c63f6.tar.gz emacs-5ddbd8d191e7e38167a63728c6ead5a6401c63f6.zip | |
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.
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 6 |
1 files changed, 5 insertions, 1 deletions
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." | |||
| 1468 | (progn | 1468 | (progn |
| 1469 | (if (setq lit-start (c-literal-start from)) ; Have we landed in a string/comment? | 1469 | (if (setq lit-start (c-literal-start from)) ; Have we landed in a string/comment? |
| 1470 | (goto-char lit-start)) | 1470 | (goto-char lit-start)) |
| 1471 | (c-backward-syntactic-ws) ; ? put a limit here, maybe? | 1471 | (c-backward-syntactic-ws (c-point 'bopl)) |
| 1472 | (setq vsemi-pos (point)) | 1472 | (setq vsemi-pos (point)) |
| 1473 | (c-at-vsemi-p)))) | 1473 | (c-at-vsemi-p)))) |
| 1474 | (throw 'done vsemi-pos)) | 1474 | (throw 'done vsemi-pos)) |
| 1475 | ;; Optimize for large blocks of comments. | ||
| 1476 | ((progn (c-forward-syntactic-ws to) | ||
| 1477 | (>= (point) to)) | ||
| 1478 | (throw 'done nil)) | ||
| 1475 | ;; In a string/comment? | 1479 | ;; In a string/comment? |
| 1476 | ((setq lit-range (c-literal-limits from)) | 1480 | ((setq lit-range (c-literal-limits from)) |
| 1477 | (goto-char (cdr lit-range))) | 1481 | (goto-char (cdr lit-range))) |