]> git.eshelyaron.com Git - sweep.git/log
sweep.git
11 months agoAnnounce recent changes in NEWS.org and bump version to 0.27.2 V9.1.19-sweep-0.27.2
Eshel Yaron [Mon, 27 Nov 2023 07:22:13 +0000 (08:22 +0100)]
Announce recent changes in NEWS.org and bump version to 0.27.2

11 months agoImprove hole highlighting in the Sweep top-level
Eshel Yaron [Mon, 27 Nov 2023 07:16:47 +0000 (08:16 +0100)]
Improve hole highlighting in the Sweep top-level

* sweeprolog.el (sweeprolog-analyze-end-font-lock): Extract hole
highlighting code to...
(sweeprolog--highlight-holes): New function.
(sweeprolog-colourise-query): Use it.
(sweeprolog-fill-holes): New command.
(sweeprolog--fill-query-holes): New function.
(sweeprolog-top-level-mode): Use it to fill holes in query when
posting it.

* sweep.texi (Filling Holes): Document 'sweeprolog-fill-holes'.

11 months ago; Add test for 'forward/backward-sexp' in strings
Eshel Yaron [Sun, 26 Nov 2023 11:52:02 +0000 (12:52 +0100)]
; Add test for 'forward/backward-sexp' in strings

11 months agoAdapt 'derived-mode-p' calls to Emacs 30.1 calling convention
Eshel Yaron [Sun, 26 Nov 2023 10:50:35 +0000 (11:50 +0100)]
Adapt 'derived-mode-p' calls to Emacs 30.1 calling convention

11 months agoUse a few more hook functions also in top-level buffers
Eshel Yaron [Sun, 26 Nov 2023 10:47:15 +0000 (11:47 +0100)]
Use a few more hook functions also in top-level buffers

* sweeprolog.el (sweeprolog-top-level-mode): Set
'forward-sexp-function', 'beginning-of-defun-function',
'end-of-defun-function' and 'syntax-propertize-function' hooks to
their Prolog-specific value that we already use in 'sweeprolog-mode'.

11 months agoRespect 'syntax-table' text properties
Eshel Yaron [Sun, 26 Nov 2023 10:33:57 +0000 (11:33 +0100)]
Respect 'syntax-table' text properties

Replace all usages of (char-syntax (char-before/after ...)) with
'syntax-after' calls, since the former doesn't take into account the
'syntax-table' text property that 'syntax-propertize-function' adds.
In particular, this fixes an issue with 'forward-sexp' over character
literals such as "0'c".

* sweeprolog.el (sweeprolog-syntax-propertize): Replace with...
(sweeprolog-syntax-propertize-function): New 'defconst'.
(sweeprolog-mode): Use it.
(sweeprolog--op-p, sweeprolog-syntax-class-at): New 'defsubst'.
(sweeprolog--parse-context, sweeprolog--completion-at-point)
(sweeprolog-next-token-boundaries, sweeprolog-last-token-boundaries)
(sweeprolog--forward-term, sweeprolog--backward-term)
(sweeprolog--precedence-at-point,sweeprolog-align-spaces)
(sweeprolog-indent-line): Respect 'syntax-table' text properties.

* sweeprolog-tests.el (backward-sexp-over-char-literal): Test it.

11 months agoFix docs for predicate at point in DCG bodies
Eshel Yaron [Fri, 24 Nov 2023 11:18:40 +0000 (12:18 +0100)]
Fix docs for predicate at point in DCG bodies

* sweep.pl (sweep_short_documentation_body/9): Add special handling
for control constructs in DCG bodies.
* sweeprolog-tests.el (eldoc-dcg): New test.

11 months agoAdd a few missing CHR-specific faces and help messages
Eshel Yaron [Thu, 23 Nov 2023 10:44:23 +0000 (11:44 +0100)]
Add a few missing CHR-specific faces and help messages

* sweeprolog.el (sweeprolog-deprecated):
(sweeprolog-delimiter):
(sweeprolog-pragma):
(sweeprolog-chr-type): New faces.
(sweeprolog-analyze-fragment-to-faces): Use them.
(sweeprolog-analyze-fragment-help-echo): Add 'help-echo' text for
CHR-specific term kinds.
(sweeprolog--help-echo-for-goal-functor): Shorten messages.

11 months agoAnnounce recent changes in NEWS.org and bump version to 0.27.1 V9.1.19-sweep-0.27.1
Eshel Yaron [Thu, 16 Nov 2023 19:26:44 +0000 (20:26 +0100)]
Announce recent changes in NEWS.org and bump version to 0.27.1

11 months ago* sweeprolog.el (sweeprolog-read-predicate): Require match.
Eshel Yaron [Thu, 16 Nov 2023 18:44:15 +0000 (19:44 +0100)]
* sweeprolog.el (sweeprolog-read-predicate): Require match.

11 months agoADDED: in-buffer completions for Prolog flags
Eshel Yaron [Thu, 16 Nov 2023 18:39:09 +0000 (19:39 +0100)]
ADDED: in-buffer completions for Prolog flags

* sweep.pl (sweep_context_callable_arg/4): Report "flag" context.
(sweep_flags_collection/2): New predicate.
* sweeprolog.el (sweeprolog--flag-completion-at-point): New function.
(sweeprolog--atom-or-functor-completion-at-point): Use it.
* sweeprolog-tests.el (cap-flag-name): New test.
* sweep.texi (Code Completion): Update.

11 months ago; Further optimize predicate completion at point
Eshel Yaron [Tue, 14 Nov 2023 12:54:59 +0000 (13:54 +0100)]
; Further optimize predicate completion at point

11 months ago; * sweeprolog.el (-predicate-completion-candidates): Fix typo
Eshel Yaron [Tue, 14 Nov 2023 12:40:56 +0000 (13:40 +0100)]
; * sweeprolog.el (-predicate-completion-candidates): Fix typo

11 months agoNarrow to current query for top-level completion at point
Eshel Yaron [Tue, 14 Nov 2023 08:47:15 +0000 (09:47 +0100)]
Narrow to current query for top-level completion at point

* sweeprolog.el (sweeprolog-top-level-completion-at-point): New function.
(sweeprolog-top-level-mode): Use it.

11 months agoOptimize predicate completion at point
Eshel Yaron [Tue, 14 Nov 2023 08:40:21 +0000 (09:40 +0100)]
Optimize predicate completion at point

* sweep.pl (sweep_heads_collection/2): Optimize for speed.  Also
report functor length and arity for each candidate to facilitate
faster sorting.
* sweeprolog.el (sweeprolog-init-args): Add '-O'.
(sweeprolog-predicate-completion-candidates): Improve sorting.

11 months ago; Fix fresh variable naming in term replacement
Eshel Yaron [Mon, 13 Nov 2023 14:13:04 +0000 (15:13 +0100)]
; Fix fresh variable naming in term replacement

11 months ago; Exclude grammar rules from regular goal completion
Eshel Yaron [Mon, 13 Nov 2023 13:11:07 +0000 (14:11 +0100)]
; Exclude grammar rules from regular goal completion

* sweep.pl (sweep_heads_collection/2): Exclude DCG non-terminals when
completing a regular goal.

11 months ago; Fix naming of implicit DCG arguments in completion candidates
Eshel Yaron [Mon, 13 Nov 2023 13:04:54 +0000 (14:04 +0100)]
; Fix naming of implicit DCG arguments in completion candidates

* sweep.pl (predicate_argument_names/3): Make implicit arguments
appear as anonymous variables.

11 months agoAnnounce recent changes in NEWS.org and bump version to 0.27.0 V9.1.18-0.27.0
Eshel Yaron [Sun, 12 Nov 2023 18:31:59 +0000 (19:31 +0100)]
Announce recent changes in NEWS.org and bump version to 0.27.0

11 months ago; Inhibit ElDoc messages for common Prolog control constructs
Eshel Yaron [Sun, 12 Nov 2023 18:30:52 +0000 (19:30 +0100)]
; Inhibit ElDoc messages for common Prolog control constructs

11 months ago; * sweep.texi (Showing Prolog Docs): Reword.
Eshel Yaron [Sun, 12 Nov 2023 17:51:20 +0000 (18:51 +0100)]
; * sweep.texi (Showing Prolog Docs): Reword.

11 months ago; Silence syntax errors when rereading predicate modes term
Eshel Yaron [Sun, 12 Nov 2023 17:08:00 +0000 (18:08 +0100)]
; Silence syntax errors when rereading predicate modes term

11 months agoHighlight current argument in ElDoc documentation messages
Eshel Yaron [Sun, 12 Nov 2023 16:53:17 +0000 (17:53 +0100)]
Highlight current argument in ElDoc documentation messages

* sweep.pl (sweep_short_documentation/2): New predicate.
* sweeprolog.el (sweeprolog-predicate-modes-doc): Use it.

11 months agoUse bespoke face for the ElDoc callback ':face' argument
Eshel Yaron [Sat, 11 Nov 2023 15:57:30 +0000 (16:57 +0100)]
Use bespoke face for the ElDoc callback ':face' argument

* sweeprolog.el (sweeprolog-predicate-modes-doc): Use
'sweeprolog-predicate-indicator' face instead of
'font-lock-function-name-face'.

12 months agoAnnounce recent changes in NEWS.org and bump version to 0.26.2 V9.1.18-0.26.2 V9.1.19 V9.1.20 V9.1.21
Eshel Yaron [Thu, 9 Nov 2023 20:29:47 +0000 (21:29 +0100)]
Announce recent changes in NEWS.org and bump version to 0.26.2

12 months agoHandle SIGHUP in daemon mode when killing a tty top-level
Eshel Yaron [Thu, 9 Nov 2023 19:47:57 +0000 (20:47 +0100)]
Handle SIGHUP in daemon mode when killing a tty top-level

When Emacs is running as a daemon, and deletes the process of a
top-level that uses a tty, the top-level receives SIGHUP.  But since
the top-level is a thread is the same process as Emacs itself, this
results in 'kill-emacs'.  To prevent this unfortunate outcome, set a
no-op handler for SIGHUP before deleting the top-level process and
restore the original handler afterwards.

* sweep.pl (sweep_nohup/2): New predicate.
* sweeprolog.el (sweeprolog-top-level-filter): New function.
(sweeprolog-top-level-buffer): Use it.

12 months ago; * sweep.texi: Fix chapter description
Eshel Yaron [Thu, 9 Nov 2023 19:46:42 +0000 (20:46 +0100)]
; * sweep.texi: Fix chapter description

12 months agoAnnounce recent changes in NEWS.org and bump version to 0.26.1 V9.1.17-0.26.1
Eshel Yaron [Sun, 29 Oct 2023 18:17:00 +0000 (19:17 +0100)]
Announce recent changes in NEWS.org and bump version to 0.26.1

12 months agoAvoid possible race condition with tty top-level creation
Eshel Yaron [Sun, 29 Oct 2023 17:36:48 +0000 (18:36 +0100)]
Avoid possible race condition with tty top-level creation

* sweeprolog.el (sweeprolog-top-level-buffer): Create the top-level
thread before calling stty.

12 months agoSetup Xref in 'sweeprolog-top-level-mode'
Philip Kaludercic [Fri, 27 Oct 2023 16:58:55 +0000 (18:58 +0200)]
Setup Xref in 'sweeprolog-top-level-mode'

* sweeprolog.el (sweeprolog-top-level-mode): Add
'sweeprolog--xref-backend' to 'xref-backend-functions'.

12 months ago; * sweep.texi (Code Completion): Fix typo.
Eshel Yaron [Mon, 23 Oct 2023 06:21:20 +0000 (08:21 +0200)]
; * sweep.texi (Code Completion): Fix typo.

12 months agoAnnounce recent changes in NEWS.org and bump version to 0.26.0 V9.1.17-0.26.0
Eshel Yaron [Sun, 22 Oct 2023 20:16:56 +0000 (22:16 +0200)]
Announce recent changes in NEWS.org and bump version to 0.26.0

12 months agoADDED: in-buffer completions for arithmetic functions
Eshel Yaron [Sun, 22 Oct 2023 19:50:02 +0000 (21:50 +0200)]
ADDED: in-buffer completions for arithmetic functions

* sweep.pl (sweep_function_functors_collection/2)
(sweep_functions_collection/2): New predicates.
(sweep_context_callable_arg/4): Recognize arithmetic functions.

* sweeprolog.el (sweeprolog-arith-functor-completion-candidates)
(sweeprolog-arith-completion-candidates): New functions, used in...
(sweeprolog--atom-or-functor-completion-at-point): ...here.

* sweep.texi (Code Completion): Document arithmetic function completion.
* sweeprolog-tests.el: Test it.

12 months agoADDED: in-buffer completions for predicate options
Eshel Yaron [Sun, 22 Oct 2023 17:52:22 +0000 (19:52 +0200)]
ADDED: in-buffer completions for predicate options

* sweep.pl (sweep_option_functors_collection/2)
(sweep_options_collection/2)
(sweep_option_arguments_collection/2): New predicates.
(sweep_context_callable_arg/4): Recognize predicate options.

* sweeprolog.el (sweeprolog-option-functor-completion-candidates)
(sweeprolog-option-completion-candidates)
(sweeprolog-option-arg-completion-candidates): New functions, used in...
(sweeprolog--atom-or-functor-completion-at-point): ...here.

* sweep.texi (Code Completion): Document predicate options completion.
* sweeprolog-tests.el: Test it.

12 months agoADDED: in-buffer completions for source file specs
Eshel Yaron [Sun, 22 Oct 2023 16:17:23 +0000 (18:17 +0200)]
ADDED: in-buffer completions for source file specs

* sweep.pl (sweep_alias_source_file_name_collection/2)
(sweep_alias_source_file_name/4)
(sweep_source_file_name_collection/2)
(sweep_source_file_name/3)
(sweep_path_alias_collection/2)
(sweep_matching_path_alias/3): New predicates.
(sweep_context_callable_/3): Simplify, and recognize predicate
arguments that should be source file specifications.

* sweeprolog.el (sweeprolog-source-functor-completion-candidates)
(sweeprolog-alias-source-completion-candidates)
(sweeprolog-source-completion-candidates): New functions, used in...
(sweeprolog--atom-or-functor-completion-at-point): ...here.
(sweeprolog-electric-layout-post-self-insert-function)
(sweeprolog-context-menu-for-region)
(sweeprolog-maybe-extract-region-to-predicate): Adapt.

* sweep.texi (Code Completion): Document file spec completion.
* sweeprolog-tests.el: Test it.

12 months agoStop pty echo with 'stty' instead of 'comint-process-echoes'
Eshel Yaron [Sun, 22 Oct 2023 12:09:23 +0000 (14:09 +0200)]
Stop pty echo with 'stty' instead of 'comint-process-echoes'

* sweeprolog.el (sweeprolog-top-level-buffer): Call 'stty PTY -echo'
on GNU/Linux systems.

12 months agoRevert "Set Prolog flag 'tty_control' to 'true' when using pty"
Eshel Yaron [Sun, 22 Oct 2023 12:03:14 +0000 (14:03 +0200)]
Revert "Set Prolog flag 'tty_control' to 'true' when using pty"

This reverts commit d70195ede30df33098f58cc6ba5fd19c26495055.

12 months agoAnnounce recent changes in NEWS.org and bump version to 0.25.5 V9.1.17-0.25.5
Eshel Yaron [Fri, 20 Oct 2023 18:31:14 +0000 (20:31 +0200)]
Announce recent changes in NEWS.org and bump version to 0.25.5

12 months agoExpand Top-level documentation
Eshel Yaron [Fri, 20 Oct 2023 18:14:01 +0000 (20:14 +0200)]
Expand Top-level documentation

* sweep.texi (Top-level Interaction): New section, replaces...
(Top-level Completion): Remove.
(The Prolog Top-level): Update menu and document ANSI
escape sequence handling.

12 months agoEmit highlighted messages in the top-level
Eshel Yaron [Fri, 20 Oct 2023 15:58:47 +0000 (17:58 +0200)]
Emit highlighted messages in the top-level

* sweep.pl: Ensure 'library(ansi_term)' gets loaded.
(sweep_top_level_client/4): Set the flag 'verbose' to 'normal' in
order to enable informational messages, and set 'color_term' to 'true'
to enable highlighting when using a pty.

12 months agoSet Prolog flag 'tty_control' to 'true' when using pty
Eshel Yaron [Fri, 20 Oct 2023 14:51:15 +0000 (17:51 +0300)]
Set Prolog flag 'tty_control' to 'true' when using pty

When 'sweeprolog-top-level-use-pty' is non-nil, let the Prolog
top-level thread know that it controls the tty.  This affects some
aspects of the top-level interaction, namely in the presence of choice
points.  A significant benefit is that Prolog ensures that the tty
does not echo input, so we can stop setting 'comint-process-echoes'
which had the adverse effect of blocking Emacs when output stalls on
non-echoing terminals.

* sweep.pl (sweep_top_level_client/3): Become
'sweep_top_level_client/4'.  New argument says whether the top-level
controls the tty.
(sweep_top_level_pty_client/1,sweep_top_level_server_loop_/2): Adjust.
* sweeprolog.el (sweeprolog-top-level-buffer): Stop setting
'comint-process-echoes'.
(sweeprolog-top-level--post-self-insert-function): When using a tty,
send single character responses directly and assume that the top-level
echoes them back.

12 months ago; * sweep.texi: Fix typo
Eshel Yaron [Thu, 19 Oct 2023 08:17:35 +0000 (10:17 +0200)]
; * sweep.texi: Fix typo

12 months ago* sweep.texi (Things To Do): Add new to-do items
Eshel Yaron [Sun, 15 Oct 2023 16:19:54 +0000 (18:19 +0200)]
* sweep.texi (Things To Do): Add new to-do items

12 months ago; Adapt tests following last change
Eshel Yaron [Sun, 15 Oct 2023 11:11:13 +0000 (13:11 +0200)]
; Adapt tests following last change

12 months agoSort predicate completion candidates by functor length
Eshel Yaron [Sun, 15 Oct 2023 10:37:36 +0000 (12:37 +0200)]
Sort predicate completion candidates by functor length

* sweeprolog.el (sweeprolog-predicate-completion-sort): New function.
(sweeprolog-predicate-completion-candidates): Use it as
`display-sort-function`.

13 months agoAnnounce recent changes in NEWS.org and bump version to 0.25.4 V9.1.16-sweep-0.25.4
Eshel Yaron [Sun, 8 Oct 2023 11:55:56 +0000 (13:55 +0200)]
Announce recent changes in NEWS.org and bump version to 0.25.4

13 months ago; Improve detection of unsafe goal extraction
Eshel Yaron [Sun, 8 Oct 2023 10:35:09 +0000 (12:35 +0200)]
; Improve detection of unsafe goal extraction

* sweep.pl (sweep_extract_goal_update_safety/4): Adjust.
* sweeprolog-tests.el: Add more tests.

13 months agoFix extracting goals in right associative operator chains
Eshel Yaron [Sun, 8 Oct 2023 10:13:38 +0000 (12:13 +0200)]
Fix extracting goals in right associative operator chains

* sweep.pl (push_assoc_arg/9): New helper predicate.
(sweep_extract_goal_term/21): Recognize and correctly handle right
associative operator chains.
(sweep_extract_goal_update_clause_string/7): Fix handling of nested
disjunctions.
* sweeprolog-tests.el: Add more goal extraction tests.
* sweeprolog.el (sweeprolog-extract-region-to-predicate): Add missing
call to 'format'.

13 months agoAnnounce recent changes in NEWS.org and bump version to 0.25.3 V9.1.16-sweep-0.25.3
Eshel Yaron [Sat, 7 Oct 2023 13:07:40 +0000 (15:07 +0200)]
Announce recent changes in NEWS.org and bump version to 0.25.3

13 months ago; Fix excluding new predicate body from replacement after extraction
Eshel Yaron [Sat, 7 Oct 2023 12:58:38 +0000 (14:58 +0200)]
; Fix excluding new predicate body from replacement after extraction

13 months agoENHANCED: Improve 'sweeprolog-extract-region-to-predicate'
Eshel Yaron [Sat, 7 Oct 2023 12:38:45 +0000 (14:38 +0200)]
ENHANCED: Improve 'sweeprolog-extract-region-to-predicate'

Teach 'sweeprolog-extract-region-to-predicate' about existentially
quantified goals and lambda terms.

* sweep.pl (sweep_term_variable_names/2): Remove from export list.
* sweep.pl (sweep_extract_goal/2): New public predicate.
* sweeprolog.el (sweeprolog-extract-region-to-predicate): Use it.
* sweeprolog-tests.el: Test it.
* sweep.texi (Extract Goal): Update documentation.

13 months ago; Improve user option docstring
Eshel Yaron [Sat, 7 Oct 2023 12:37:13 +0000 (14:37 +0200)]
; Improve user option docstring

* sweeprolog.el
(sweeprolog-query-replace-term-include-match-function): Improve docstring.

13 months ago; * sweeprolog.el (sweeprolog-query-replace-term): Update comment
Eshel Yaron [Sat, 7 Oct 2023 12:36:51 +0000 (14:36 +0200)]
; * sweeprolog.el (sweeprolog-query-replace-term): Update comment

13 months ago; Remove unused function 'sweeprolog-token-boundaries'
Eshel Yaron [Sat, 7 Oct 2023 12:30:11 +0000 (14:30 +0200)]
; Remove unused function 'sweeprolog-token-boundaries'

13 months ago; New helper predicate 'pos_bounds/3'
Eshel Yaron [Sat, 7 Oct 2023 12:29:50 +0000 (14:29 +0200)]
; New helper predicate 'pos_bounds/3'

13 months ago; Fix precedence calculation for unary operator arguments
Eshel Yaron [Sat, 7 Oct 2023 12:24:30 +0000 (14:24 +0200)]
; Fix precedence calculation for unary operator arguments

13 months ago; Recognize ext-quantified goal positions as callable
Eshel Yaron [Sat, 7 Oct 2023 12:21:31 +0000 (14:21 +0200)]
; Recognize ext-quantified goal positions as callable

13 months ago; Add missing ':type' for 'sweeprolog-top-level-use-pty'
Eshel Yaron [Wed, 27 Sep 2023 17:02:52 +0000 (19:02 +0200)]
; Add missing ':type' for 'sweeprolog-top-level-use-pty'

13 months ago; Silence some byte-complier warnings
Eshel Yaron [Wed, 27 Sep 2023 17:01:33 +0000 (19:01 +0200)]
; Silence some byte-complier warnings

13 months ago; Fix off-by-one in end of next token position for parentheses
Eshel Yaron [Tue, 26 Sep 2023 21:30:42 +0000 (23:30 +0200)]
; Fix off-by-one in end of next token position for parentheses

* sweeprolog.el (sweeprolog-next-token-boundaries): Return correct end
of token position for parentheses.

* sweeprolog-tests.el (up-list): New test.

13 months ago; Avoid relying on 'diff-mode' faces
Eshel Yaron [Sun, 24 Sep 2023 20:24:01 +0000 (22:24 +0200)]
; Avoid relying on 'diff-mode' faces

* sweeprolog.el (sweeprolog-query-replace-term-prompt-old)
(sweeprolog-query-replace-term-prompt-new): New faces.
(sweeprolog-query-replace-term): Use them instead of 'diff-mode'
faces.

13 months ago; Fix filtering of the just created body when extracting goal
Eshel Yaron [Sun, 24 Sep 2023 19:53:13 +0000 (21:53 +0200)]
; Fix filtering of the just created body when extracting goal

* sweeprolog (sweeprolog-extract-region-to-predicate): When searching
and replacing other goals subsumed by the extracted goal, use a more
robust check to filter out the newly created body term from the search
matches.

13 months ago; (sweep_replace_term_r/12): Fix qualified head classification
Eshel Yaron [Sun, 24 Sep 2023 15:17:20 +0000 (17:17 +0200)]
; (sweep_replace_term_r/12): Fix qualified head classification

13 months ago; (sweep_replace_update_state/7): Fix SSU guard classification
Eshel Yaron [Sat, 23 Sep 2023 20:09:19 +0000 (22:09 +0200)]
; (sweep_replace_update_state/7): Fix SSU guard classification

13 months agoAnnounce recent changes in NEWS.org and bump version to 0.25.2 V9.1.15-sweep-0.25.2
Eshel Yaron [Sat, 23 Sep 2023 14:42:22 +0000 (16:42 +0200)]
Announce recent changes in NEWS.org and bump version to 0.25.2

13 months agoExtract subsumed goals when extracting goal to predicate
Eshel Yaron [Sat, 23 Sep 2023 13:31:07 +0000 (15:31 +0200)]
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.

13 months ago; Improve documentation about shutting down Prolog
Eshel Yaron [Fri, 22 Sep 2023 20:21:34 +0000 (22:21 +0200)]
; Improve documentation about shutting down Prolog

* sweeprolog.el (sweeprolog-shutdown): Tweak and make interactive.
* sweep.texi (Initialization): Document it, reorganize.

13 months ago; Documentation fixes
Eshel Yaron [Fri, 22 Sep 2023 20:18:37 +0000 (22:18 +0200)]
; Documentation fixes

* sweep.texi (Top, Editing Prolog Code): Mention "Term Replace" in
menus.
(Main Features, Architecture, Alternatives): Mark as sections rather
than chapters.

13 months agoAnnounce recent changes in NEWS.org and bump version to 0.25.1 V9.1.15-sweep-0.25.1
Eshel Yaron [Fri, 22 Sep 2023 15:04:26 +0000 (17:04 +0200)]
Announce recent changes in NEWS.org and bump version to 0.25.1

13 months agoADDED: new command 'sweeprolog-query-replace-term'
Eshel Yaron [Wed, 20 Sep 2023 11:00:00 +0000 (13:00 +0200)]
ADDED: new command 'sweeprolog-query-replace-term'

This patch extends the Term Search infrastructure to support
search-and-replace operations.  Namely, we replace the predicate
'sweep_term_search/2' with a new predicate 'sweep_term_replace/2' that
subsumes the functionality of the former.  The command
'sweeprolog-term-search' is greatly simplified and adjusted to work
with this new predicate, and we introduce a new command,
'sweeprolog-query-replace-term', that exposes the new
search-and-replace facility of 'sweep_term_replace/2' in an
interactive UI inspired by 'query-replace'.

* sweep.pl (sweep_term_search/2): Remove in favor of...
(sweep_term_replace/2): New predicate.
* sweeprolog.el: (sweeprolog-term-replace-edits): New function.
(sweeprolog-term-search): Rewrite.
(sweeprolog-term-search-last-search)
(sweeprolog-term-search-overlays)
(sweeprolog-term-search-repeat-count)
(sweeprolog-term-search-repeat-backward)
(sweeprolog-term-search-repeat-forward)
(sweeprolog-term-search-abort)
(sweeprolog-term-search-in-buffer)
(sweeprolog-term-search-next)
(sweeprolog-term-search-map): Remove, unused.
(sweeprolog-query-replace-term): New command.
(sweeprolog-mode-map): Bind it.
* sweeprolog-tests.el (term-search)
* sweep.texi (Term Search): Adjust.
(Term Replace): New section.

13 months agoAnnounce recent changes in NEWS.org and bump version to 0.25.0 V9.1.15-sweep-0.25.0
Eshel Yaron [Sun, 17 Sep 2023 07:44:12 +0000 (09:44 +0200)]
Announce recent changes in NEWS.org and bump version to 0.25.0

13 months ago; * sweeprolog.el: Add docstrings for recently added functions
Eshel Yaron [Sun, 17 Sep 2023 06:44:56 +0000 (08:44 +0200)]
; * sweeprolog.el: Add docstrings for recently added functions

13 months agoSet 'comint-process-echoes' for top-levels that use a tty
Eshel Yaron [Sat, 16 Sep 2023 21:00:06 +0000 (23:00 +0200)]
Set 'comint-process-echoes' for top-levels that use a tty

13 months agoImprove top-level input fontification
Eshel Yaron [Sat, 16 Sep 2023 20:28:02 +0000 (22:28 +0200)]
Improve top-level input fontification

13 months agoImprove top-level threads management and cleanup
Eshel Yaron [Sat, 16 Sep 2023 18:50:47 +0000 (20:50 +0200)]
Improve top-level threads management and cleanup

* sweep.pl (sweep_top_level_thread_buffer/2): Remove predicate.
(sweep_top_level_threads/2): Remove in favor of...
(sweep_list_threads/2): New predicate.
(sweep_accept_top_level_client/2)
(sweep_top_level_start_pty/2): Return new thread id.
(sweep_cleanup_threads/0,2)
(sweep_create_thread/2,3)
(sweep_thread_start/0)
(sweep_thread_at_exit/0)
(sweep_supervisor_start/1)
(sweep_supervisor_loop/1)
(sweep_kill_thread/2)
(sweep_cleanup_thread/1): New predicates.

* sweeprolog.el (sweeprolog-init): Arrange for Sweep to shutdown
gracefully when Emacs is killed.
(sweeprolog-maybe-kill-top-levels)
(sweeprolog-maybe-shutdown)
(sweeprolog-shutdown)
(sweeprolog-top-level-maybe-delete-process)
(sweeprolog-top-level-delete-process): New functions.
(sweeprolog-restart)
(sweeprolog-top-level-buffer): Adapt.
(sweeprolog-top-level--populate-thread-id): Remove function.

13 months agoCheck that top-level thread is alive when signaling it
Eshel Yaron [Fri, 15 Sep 2023 08:08:04 +0000 (10:08 +0200)]
Check that top-level thread is alive when signaling it

* sweeprolog.el (sweeprolog-top-level-signal-current): Delete stale
pty "process" when trying to signal a top-level thread that has
already exited.

13 months ago; Don't refuse to kill top-level buffer with deleted process
Eshel Yaron [Thu, 14 Sep 2023 20:48:30 +0000 (22:48 +0200)]
; Don't refuse to kill top-level buffer with deleted process

13 months ago; Fix error on Emacs 27 with no 'font-lock-keywords'
Eshel Yaron [Thu, 14 Sep 2023 20:47:07 +0000 (22:47 +0200)]
; Fix error on Emacs 27 with no 'font-lock-keywords'

13 months agoENHANCED: Support pty top-level communication instead of TCP
Eshel Yaron [Thu, 14 Sep 2023 16:28:16 +0000 (18:28 +0200)]
ENHANCED: Support pty top-level communication instead of TCP

Add the ability for top-level buffers to communicate with their
backing threads via pty instead of a local TCP connection.  This is
controlled by a new user option, enabled by default on systems where
Emacs can creates a pty.

* sweep.pl (sweep_top_level_start_pty/2): New predicate.
* sweeprolog.el (sweeprolog-top-level-use-pty): New user option.
(sweeprolog-top-level-buffer): Use it.
* sweep.texi (The Prolog Top-level): Document it.

13 months agoProvide basic 'prettify-symbols-alist' in Sweep Prolog mode
Eshel Yaron [Thu, 14 Sep 2023 16:23:48 +0000 (18:23 +0200)]
Provide basic 'prettify-symbols-alist' in Sweep Prolog mode

* sweeprolog.el (sweeprolog-mode): set a local value for
'prettify-symbols-alist' that renders the neck operator as a unicode
left arrow.

13 months agoSupport Prettify Symbols and similar minor modes
Eshel Yaron [Thu, 14 Sep 2023 16:20:33 +0000 (18:20 +0200)]
Support Prettify Symbols and similar minor modes

* sweeprolog.el (sweeprolog-analyze-some-terms): Call
'font-lock-fontify-keywords-region' to support minor modes that
rely on 'font-lock-keywords'.

13 months ago; * sweeprolog.el (sweeprolog-hole): Avoid increasing text size
Eshel Yaron [Thu, 14 Sep 2023 16:18:19 +0000 (18:18 +0200)]
; * sweeprolog.el (sweeprolog-hole): Avoid increasing text size

14 months ago; * sweep.texi (Extract Goal): Improve indexing
Eshel Yaron [Sat, 9 Sep 2023 14:36:55 +0000 (16:36 +0200)]
; * sweep.texi (Extract Goal): Improve indexing

14 months agoAnnounce recent changes in NEWS.org and bump version to 0.24.1 V9.1.15-sweep-0.24.1
Eshel Yaron [Sat, 9 Sep 2023 07:57:31 +0000 (09:57 +0200)]
Announce recent changes in NEWS.org and bump version to 0.24.1

14 months agoOnly extract goals to separate predicates, not data terms
Eshel Yaron [Sat, 9 Sep 2023 07:32:38 +0000 (09:32 +0200)]
Only extract goals to separate predicates, not data terms

* sweeprolog.el (sweeprolog-context-menu-for-region)
(sweeprolog-maybe-extract-region-to-predicate): Check that the region
starts in a callable position.
(sweeprolog-extract-region-to-predicate): Reanalyze the buffer as a
last step.
* sweep.texi: Adjust.

14 months agoOnly enable right-click actions on region when click is in region
Eshel Yaron [Fri, 8 Sep 2023 20:29:06 +0000 (22:29 +0200)]
Only enable right-click actions on region when click is in region

* sweeprolog.el (sweeprolog-context-menu-region-beg-at-click)
(sweeprolog-context-menu-region-end-at-click): New variables.
(sweeprolog-context-menu-function): Let-bind them.
(sweeprolog-context-menu-for-region): Use them to reliably check that
click is actually inside the selected region.

14 months ago; * sweep.texi: Minor improvements
Eshel Yaron [Fri, 8 Sep 2023 19:57:41 +0000 (21:57 +0200)]
; * sweep.texi: Minor improvements

14 months ago; * sweep.texi (Extract Goal): Fix typos
Eshel Yaron [Fri, 8 Sep 2023 17:54:17 +0000 (19:54 +0200)]
; * sweep.texi (Extract Goal): Fix typos

14 months ago; * sweep.texi: Update menus
Eshel Yaron [Fri, 8 Sep 2023 17:45:59 +0000 (19:45 +0200)]
; * sweep.texi: Update menus

14 months agoAnnounce recent changes in NEWS.org and bump version to 0.24.0 V9.1.15-sweep-0.24.0
Eshel Yaron [Fri, 8 Sep 2023 17:35:34 +0000 (19:35 +0200)]
Announce recent changes in NEWS.org and bump version to 0.24.0

14 months agoADDED: New command 'sweeprolog-extract-region-to-predicate'
Eshel Yaron [Fri, 8 Sep 2023 17:25:44 +0000 (19:25 +0200)]
ADDED: New command 'sweeprolog-extract-region-to-predicate'

Add a command for extracting a part of a clause body into a separate
predicate.

* sweep.pl (sweep_term_variable_names/2)
(sweep_goal_may_cut/2): New helper predicates.
* sweeprolog.el (sweeprolog-extract-region-to-predicate): New command.
(sweeprolog-maybe-extract-region-to-predicate): New function.
(sweeprolog-insert-term-functions): Add it.
* sweep.texi (Insert Term DWIM, Extract Goal): Document it.

14 months agoCleanup 'defcustom' types and docstrings
Eshel Yaron [Mon, 4 Sep 2023 11:58:26 +0000 (13:58 +0200)]
Cleanup 'defcustom' types and docstrings

* sweeprolog.el (sweeprolog-swipl-sources)
(sweeprolog-module-header-comment-skeleton)
(sweeprolog-indent-offset, sweeprolog-qq-mode-alist)
(sweeprolog-enable-cycle-spacing)
(sweeprolog-analyze-buffer-on-idle)
(sweeprolog-analyze-buffer-max-size)
(sweeprolog-analyze-buffer-min-interval)
(sweeprolog-swipl-path)
(sweeprolog-messages-buffer-name)
(sweeprolog-read-flag-prompt)
(sweeprolog-read-module-prompt)
(sweeprolog-read-predicate-prompt)
(sweeprolog-read-exportable-predicate-prompt)
(sweeprolog-read-pack-prompt)
(sweeprolog-top-level-display-action)
(sweeprolog-top-level-min-history-length)
(sweeprolog-init-args)
(sweeprolog-enable-flymake)
(sweeprolog-note-implicit-autoloads)
(sweeprolog-enable-eldoc)
(sweeprolog-enable-cursor-sensor)
(sweeprolog-new-predicate-location-function)
(sweeprolog-top-level-signal-default-goal)
(sweeprolog-highlight-holes)
(sweeprolog-read-predicate-documentation-function)
(sweeprolog-enable-help-echo)
(sweeprolog-rename-variable-allow-existing)
(sweeprolog-dependency-directive)
(sweeprolog-highlight-breakpoints)
(sweeprolog-top-level-persistent-history): Minor docstring and ':type'
touch ups.
(sweeprolog-init-on-load): Remove obsolete option.
(sweeprolog-libswipl-path): Remove unused option.
(sweeprolog-menu)
(sweeprolog-start-prolog-server)
(sweeprolog-message)
(sweeprolog-top-level-menu-kill)
(sweeprolog-top-level-menu-go-to)
(sweeprolog-top-level-menu-mode): Minor docstring improvements.
(sweeprolog-submit-bug-report): Stop including
'sweeprolog-libswipl-path' in bug reports.

14 months agoAdd included copy of 'emacs-module.h' to '.elpaignore'
Eshel Yaron [Sun, 3 Sep 2023 09:46:37 +0000 (11:46 +0200)]
Add included copy of 'emacs-module.h' to '.elpaignore'

14 months agoPORT: MSVC V9.1.15 V9.1.16 V9.1.17 V9.1.18
Jan Wielemaker [Fri, 1 Sep 2023 15:57:19 +0000 (17:57 +0200)]
PORT: MSVC

Need to get DLL linkage correct.  This also requires a change in
SWI-Prolog.h

14 months agoPORT: Include local copy of emacs-module.h in case this is not provided.
Jan Wielemaker [Fri, 1 Sep 2023 15:28:18 +0000 (17:28 +0200)]
PORT: Include local copy of emacs-module.h in case this is not provided.

14 months agoDelete README.org (superseded by sweep.texi and README.md)
Eshel Yaron [Thu, 31 Aug 2023 11:10:54 +0000 (13:10 +0200)]
Delete README.org (superseded by sweep.texi and README.md)

14 months ago* .elpaignore: Exclude more files from package tarball
Eshel Yaron [Thu, 31 Aug 2023 11:05:12 +0000 (13:05 +0200)]
* .elpaignore: Exclude more files from package tarball

14 months agoDelete unused .gitmodules file
Eshel Yaron [Thu, 31 Aug 2023 11:04:37 +0000 (13:04 +0200)]
Delete unused .gitmodules file

14 months ago* sweeprolog.el: Update commentary.
Eshel Yaron [Thu, 31 Aug 2023 11:03:50 +0000 (13:03 +0200)]
* sweeprolog.el: Update commentary.

14 months agoAdd a small README file in Markdown format
Eshel Yaron [Thu, 31 Aug 2023 11:02:15 +0000 (13:02 +0200)]
Add a small README file in Markdown format

* README.md: New file.