emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/sweeprolog c24190141d 5/7: ; Fix off-by-one in end of next


From: ELPA Syncer
Subject: [nongnu] elpa/sweeprolog c24190141d 5/7: ; Fix off-by-one in end of next token position for parentheses
Date: Wed, 27 Sep 2023 16:01:33 -0400 (EDT)

branch: elpa/sweeprolog
commit c24190141da32abef40ab74ad8f3eaab26edf421
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>

    ; Fix off-by-one in end of next token position for parentheses
    
    * sweeprolog.el (sweeprolog-next-token-boundaries): Return correct end
    of token position for parentheses.
    
    * sweeprolog-tests.el (up-list): New test.
---
 sweeprolog-tests.el | 13 +++++++++++++
 sweeprolog.el       |  6 +++---
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/sweeprolog-tests.el b/sweeprolog-tests.el
index 09f711fb86..06f9ec24f3 100644
--- a/sweeprolog-tests.el
+++ b/sweeprolog-tests.el
@@ -1770,4 +1770,17 @@ f:o(Bar) --> baz(Bar)."
   (forward-line)
   (should (string= (add-log-current-defun) "f:o//1")))
 
+(sweeprolog-deftest up-list ()
+  "Test `up-list' support."
+  "
+foo((A,B)) =>
+    (   bar(-!-A)
+    ;   baz(B)
+    ).
+"
+  (call-interactively #'up-list)
+  (should (= (point) 30))
+  (call-interactively #'up-list)
+  (should (= (point) 51)))
+
 ;;; sweeprolog-tests.el ends here
diff --git a/sweeprolog.el b/sweeprolog.el
index cfc524a517..a17253f538 100644
--- a/sweeprolog.el
+++ b/sweeprolog.el
@@ -4277,11 +4277,11 @@ work."
                 (forward-char -1))
               (list 'operator beg (if (= beg (point)) end (point)))))
            ((= syn ?\()
-            (list 'open beg (point)))
+            (list 'open beg (1+ beg)))
            ((= syn ?\))
-            (list 'close beg (point)))
+            (list 'close beg (1+ beg)))
            ((= syn ?>) nil)
-           (t (list 'else beg (point)))))))))
+           (t (list 'else beg (1+ beg)))))))))
 
 (defun sweeprolog-last-token-boundaries (&optional pos)
   (let ((point (or pos (point)))



reply via email to

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