]> git.eshelyaron.com Git - sweep.git/commit
Extract subsumed goals when extracting goal to predicate
authorEshel Yaron <me@eshelyaron.com>
Sat, 23 Sep 2023 13:31:07 +0000 (15:31 +0200)
committerEshel Yaron <me@eshelyaron.com>
Sat, 23 Sep 2023 14:04:49 +0000 (16:04 +0200)
commit3fe4bcb60cdd6bd333a1aa10c6ed95e23029a608
tree238267c0bedc480e28a1509a78957213fcc509d5
parentacb57675b5903778e2f740c624f04f7de4a7d0f0
Extract subsumed goals when extracting goal to predicate

Extend 'sweeprolog-extract-region-to-predicate' with the ability to
replace other goals in the current buffer that are subsumed by the
extracted goal with calls to the predicate this command creates.
'sweeprolog-extract-region-to-predicate' now does this when it is
called with a prefix argument.  Also make
'sweeprolog-insert-term-dwim' propagate the prefix argument to
functions in 'sweeprolog-insert-term-functions'.

* sweeprolog.el (sweeprolog-insert-term-dwim): Add ARG argument and
pass it to functions listed...
(sweeprolog-insert-term-functions): ...here.  Adjust docstring.
(sweeprolog-maybe-insert-next-clause)
(sweeprolog-maybe-define-predicate)
(sweeprolog-maybe-extract-region-to-predicate): Adjust accordingly.
(sweeprolog-default-new-predicate-location): Go to end of line in case
there's a comment on the last line of the current predicate
definition.
(sweeprolog-query-replace-term-include-match-function): New variable.
(sweeprolog-query-replace-term): Use it.
(sweeprolog-extract-region-to-predicate): Add ALL argument.  When
non-nil, suggest replacing all goals in the buffer that are subsumbed
by the extracted goal with calls to the newly defined predicate.
sweep.texi
sweeprolog.el