[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog fbde60f59c: FIXED: sweeprolog-beginning-of-next
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog fbde60f59c: FIXED: sweeprolog-beginning-of-next-top-term: other possible loop |
Date: |
Tue, 22 Nov 2022 06:59:29 -0500 (EST) |
branch: elpa/sweeprolog
commit fbde60f59cc7bc27cb3088c028619692a279765b
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
FIXED: sweeprolog-beginning-of-next-top-term: other possible loop
* sweeprolog.el (sweeprolog-beginning-of-next-top-term): don't loop
when called in the last term of the buffer
* sweeprolog-tests.el (beginning-of-next-top-term-at-last-clause): new
test case
---
sweeprolog-tests.el | 18 ++++++++++++++++++
sweeprolog.el | 6 +++---
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/sweeprolog-tests.el b/sweeprolog-tests.el
index ed79c425f3..f096bf743b 100644
--- a/sweeprolog-tests.el
+++ b/sweeprolog-tests.el
@@ -657,6 +657,24 @@ loop_term(I, Arity, Goal1, Goal2) :-
(sweeprolog-end-of-top-term)
(should (= (point) 232))))
+(ert-deftest beginning-of-next-top-term-at-last-clause ()
+ "Test finding the beginning of next top term when there isn't one."
+ (with-temp-buffer
+ (sweeprolog-mode)
+ (insert "
+test_bindings(Name-Value) -->
+ [' '~w = ~p'-[Name-Value] ]..
+")
+ (goto-char 43)
+ (backward-delete-char 1)
+ (end-of-line)
+ (backward-delete-char 1)
+ (should (string= (buffer-string) "
+test_bindings(Name-Value) -->
+ [' ~w = ~p'-[Name-Value] ].
+"
+ ))))
+
(defun sweeprolog-test-indentation (given expected)
(with-temp-buffer
diff --git a/sweeprolog.el b/sweeprolog.el
index 2fcabbfa98..d1c585bd8f 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -2485,9 +2485,9 @@ Interactively, POINT is set to the current point."
(re-search-forward (rx bol graph) nil t)
(while (and (or (nth 8 (syntax-ppss))
(looking-at-p (rx bol (or "%" "/*"))))
- (not (eobp)))
- (re-search-forward (rx bol graph) nil t)))
- (beginning-of-line)
+ (not (eobp))
+ (re-search-forward (rx bol graph) nil t))))
+ (unless (= p (point)) (beginning-of-line))
(not (= p (point)))))
(defun sweeprolog-end-of-top-term ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/sweeprolog fbde60f59c: FIXED: sweeprolog-beginning-of-next-top-term: other possible loop,
ELPA Syncer <=