]> git.eshelyaron.com Git - dict.git/commitdiff
* sweep.pl (list_tail/2): Fix possible non-termination
authorEshel Yaron <me@eshelyaron.com>
Wed, 4 Jan 2023 08:06:37 +0000 (10:06 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 4 Jan 2023 08:08:28 +0000 (10:08 +0200)
README.org
sweep.pl
sweeprolog-tests.el

index 757f19e6509b6981dd4817730136614baa556058..b66ceb30118792af5f9fba656c743bac4a064602 100644 (file)
@@ -1338,7 +1338,7 @@ command ~M-x sweeprolog-term-search~.  This command, bound by default to
 ~C-c C-s~ in ~sweeprolog-mode~ buffers, prompts for a Prolog term to
 search for and finds terms in the current buffer that the search term
 subsumes.  For example, to find if-then-else constructs in the current
-buffer do ~C-c C-s _ ; _ -> _ RET~.
+buffer do ~C-c C-s _ -> _ ; _ RET~.
 
 #+FINDEX: sweeprolog-term-search-repeat-forward
 #+FINDEX: sweeprolog-term-search-repeat-backward
index e7e3c462237c0e9b3fc89ce6b71edd257332f4ee..c9fdf80312964273a90a5dcb89d356b464761671 100644 (file)
--- a/sweep.pl
+++ b/sweep.pl
@@ -1028,5 +1028,5 @@ sweep_match_term(parentheses_term_position(_, _, ContentPos), Term0, Term, From,
 sweep_match_term(quasi_quotation_position(_, _, SyntaxTerm, SyntaxPos, _), _, Term, From, To) :-
     sweep_match_term(SyntaxPos, SyntaxTerm, Term, From, To).
 
-list_tail([_|T0], T) :- T0 = [_|_], !, list_tail(T0, T).
+list_tail([_|T0], T) :- nonvar(T0), T0 = [_|_], !, list_tail(T0, T).
 list_tail([_|T], T).
index f2d4206daba757f9aac9f7a7a3106b141ae1f2b5..5fa1cf8df97ac850d662216a43c4d8b207683c9f 100644 (file)
@@ -85,6 +85,7 @@ foo(Baz) :- baz.
                               "pl"
                               "
 bar(bar(bar), bar{bar:bar}, [bar,bar|bar]).
+foo([Bar|Baz]).
 ")))
     (find-file-literally temp)
     (sweeprolog-mode)