For further details, please consult the manual:
<https://eshelyaron.com/sweep.html>.
+* Version 0.5.2 on 2022-10-07
+
+** Fixed bug in detecting the end of a clause with commented fullstops
+
+This version includes a fix in ~sweeprolog-end-of-top-term~, which is
+used to locate the end of the current clause. Previously this
+function would get "confused" by in-clause comments that end with a
+fullstop (see the added test case in ~sweeprolog-test.el~ for an
+example). Reported by Jan Wielemaker.
+
* Version 0.5.0 on 2022-10-04
** New special buffer for listing and working with multiple top-levels
on the top-level thread of the current buffer. This command is also
newly bound to ~C-c C-c~ in top-level buffers.
-
** New command ~sweeprolog-document-predicate-at-point~ in ~sweeprolog-mode~ buffers
~sweeprolog-document-predicate-at-point~ is a new command available in
(should (equal (sweeprolog-cut-query) t)))
+(ert-deftest fullstop-detection ()
+ "Tests detecting the fullstop in presence of confusing comments."
+ (with-temp-buffer
+ (sweeprolog-mode)
+ (insert "
+scasp_and_show(Q, Model, Tree) :-
+ scasp_mode(M0, T0),
+ setup_call_cleanup(
+ set_scasp_mode(Model, Tree),
+ ( scasp(Q, [])
+ ; false % make always nondet.
+ ),
+ set_scasp_mode(M0, T0)).
+")
+ (goto-char (point-min))
+ (sweeprolog-end-of-top-term)
+ (should (= (point) 252))))
+
(defun sweeprolog-test-indentation (given expected)
(with-temp-buffer
(sweeprolog-mode)
;; Maintainer: Eshel Yaron <~eshel/dev@lists.sr.ht>
;; Keywords: prolog languages extensions
;; URL: https://git.sr.ht/~eshel/sweep
-;; Package-Version: 0.5.1
+;; Package-Version: 0.5.2
;; Package-Requires: ((emacs "28"))
;; This file is NOT part of GNU Emacs.
(forward-char))
(or (re-search-forward (rx "." (or white "\n")) nil t)
(goto-char (point-max)))
- (while (and (nth 8 (syntax-ppss)) (not (eobp)))
+ (while (and (or (nth 8 (syntax-ppss))
+ (save-excursion
+ (nth 8 (syntax-ppss (max (point-min)
+ (1- (point)))))))
+ (not (eobp)))
(while (and (nth 8 (syntax-ppss)) (not (eobp)))
(forward-char))
(or (re-search-forward (rx "." (or white "\n")) nil t)