From: Eshel Yaron Date: Sun, 16 Oct 2022 15:18:10 +0000 (+0300) Subject: FIXED: possible loop finding start of clause at start of buffer X-Git-Tag: V8.5.18-sweep-0.6.3~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b665b84b235e36f2724077f77ccf6d62d1b3f6cb;p=sweep.git FIXED: possible loop finding start of clause at start of buffer --- diff --git a/sweeprolog.el b/sweeprolog.el index e7bd25c..d1131d3 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -1818,10 +1818,12 @@ Interactively, a prefix arg means to prompt for BUFFER." (nth 8 (syntax-ppss (1+ (point))))))) (while (and safe-start (not (bobp))) (goto-char safe-start) - (backward-char) - (re-search-backward (rx bol graph) nil t) - (setq safe-start (or (nth 8 (syntax-ppss)) - (nth 8 (syntax-ppss (1+ (point))))))))) + (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)))))))))) (not (= p (point)))) (sweeprolog-beginning-of-next-top-term (- times))))) @@ -2444,7 +2446,7 @@ predicate definition at or directly above POINT." (let ((point (point)) (fun (cadr def)) (ari (caddr def))) - (while point + (while (and point (not (bobp))) (sweeprolog-beginning-of-top-term) (backward-char 1) (if-let* ((ndef (sweeprolog-definition-at-point (point)))