[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 15c16a5: Fix minor bug in c-syntactic-re-search-for
From: |
Alan Mackenzie |
Subject: |
[Emacs-diffs] master 15c16a5: Fix minor bug in c-syntactic-re-search-forward. |
Date: |
Mon, 15 Aug 2016 16:25:36 +0000 (UTC) |
branch: master
commit 15c16a5d3b45c95bcb0855b607f975310a707ee1
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>
Fix minor bug in c-syntactic-re-search-forward.
Bug was: when NOERROR is neither nil nor t, BOUND is non-nil, PAREN-LEVEL is
non-nil, and the first internal search attempt fails, point wrongly ends up
at
BOUND, rather than just before the next closing paren.
* lisp/progmodes/cc-engine.el (c-syntactic-re-search-forward): Guard against
the above situation.
---
lisp/progmodes/cc-engine.el | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 4a29896..625e87f 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -4337,7 +4337,19 @@ comment at the start of cc-engine.el for more info."
(and
(progn
(setq search-pos (point))
- (re-search-forward regexp bound noerror))
+ (if (re-search-forward regexp bound noerror)
+ t
+ ;; Without the following, when PAREN-LEVEL it non-nil, and
+ ;; NOERROR is not nil or t, and the very first search above
+ ;; has just failed, point would end up at BOUND rather than
+ ;; just before the next close paren.
+ (when (and (eq search-pos start)
+ paren-level
+ (not (memq noerror '(nil t))))
+ (setq state (parse-partial-sexp start bound -1))
+ (if (eq (car state) -1)
+ (setq bound (1- (point)))))
+ nil))
(progn
(setq state (parse-partial-sexp
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 15c16a5: Fix minor bug in c-syntactic-re-search-forward.,
Alan Mackenzie <=