]> git.eshelyaron.com Git - dict.git/commitdiff
FIXED: beginning-of-clause detection with quoted head functors
authorEshel Yaron <me@eshelyaron.com>
Thu, 16 Feb 2023 13:00:49 +0000 (15:00 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 16 Feb 2023 13:01:32 +0000 (15:01 +0200)
* sweeprolog.el (sweeprolog-beginning-of-top-term): don't skip quoted
functors in clause heads.

sweeprolog.el

index 6bf7e5afb09b03a0de6702a51d85f7855d6eaee6..990c19fd41378679b25fad362e7d88fe688589c4 100644 (file)
@@ -3073,17 +3073,20 @@ is the prefix argument."
             (setq times (1- times))
             (when-let ((safe-start (nth 8 (syntax-ppss))))
               (goto-char safe-start))
-            (re-search-backward (rx bol graph) nil t)
-            (let ((safe-start (or (nth 8 (syntax-ppss))
-                                  (nth 8 (syntax-ppss (1+ (point)))))))
-              (while (and safe-start (not (bobp)))
-                (goto-char safe-start)
-                (if (bobp)
-                    (setq safe-start nil)
-                  (backward-char)
-                  (re-search-backward (rx bol graph) nil t)
-                  (setq safe-start (or (nth 8 (syntax-ppss))
-                                       (nth 8 (syntax-ppss (1+ (point))))))))))
+            (unless (and (sweeprolog-at-beginning-of-top-term-p)
+                         (not (= p (point))))
+              (re-search-backward (rx bol graph) nil t)
+              (let ((safe-start (or (nth 8 (syntax-ppss))
+                                    (nth 8 (syntax-ppss (1+ (point)))))))
+                (while (and safe-start (not (bobp)))
+                  (goto-char safe-start)
+                  (if (or (bobp)
+                          (sweeprolog-at-beginning-of-top-term-p))
+                      (setq safe-start nil)
+                    (backward-char)
+                    (re-search-backward (rx bol graph) nil t)
+                    (setq safe-start (or (nth 8 (syntax-ppss))
+                                         (nth 8 (syntax-ppss (1+ (point)))))))))))
           (not (= p (point))))
       (sweeprolog-beginning-of-next-top-term (- times)))))