This file contains the release notes for Sweep, an embedding of SWI-Prolog in Emacs.
For further details, see the Sweep manual: https://eshelyaron.com/sweep.html.
This command replaces the smallest term at point with the anonymous
variable, _
.
This is a maintenance release, including a couple of bug fixes:
This is a bug-fix release, resolving an issue that would manifest on X window systems with certain locales. The issue was rooted in the different assumptions Emacs and SWI-Prolog make regarding the locale, and could lead to seemingly unrelated and inexplicable errors such as:
(error "Invalid hash table rehash size" 1.0)
This is a maintenance release, including a couple of bug fixes:
Sweep now provides documentation for the predicate at point (with ElDoc) also when you’re editing a query in the top-level.
Sweep now arranges for C-M-f
, C-M-u
, and related standard commands
to operate on Prolog terms in top-level buffers, similarly to how
these commands behave in Sweep Prolog mode buffers.
This version includes better support for Constraint Handling Rules
from library(chr)
.
Sweep now provides Prolog flag completion for predicates that take a
Prolog flag as an argument, such as set_prolog_flag/2
and
current_prolog_flag/2
.
This version includes several optimizations that speed up in-buffer predicate completion.
Notably, this version fixes an issue where completion would stop working the Sweep top-level prompt whenever certain strings appeared in the output of past queries.
When displaying the documentation for the predicate at point, Sweep now highlights the argument in the predicate signature that corresponds to the argument at point. This can help you tell which term corresponds to which argument when you’re looking at a predicate call with many complex arguments.
This is a maintenance release, addressing an issue that could cause the Emacs daemon to shutdown upon deleting a top-level that uses a pseudo-terminal for communication.
This is a bugfix release, addressing an issue introduced in Sweep version 0.26.0 that could cause starting the Sweep top-level to fail on GNU/Linux systems, with the following message:
Process sweeprolog-top-level failed with code 0
Xref commands, such as M-.
and M-?
, now use Sweep’s
cross-reference backend also in top-level buffers.
This version of Sweep includes improved in-buffer completion for
predicate options (declared with predicate_options/3
), arithmetic
functions, and source file specifications (such as library(lists)
).
Sweep now sorts predicate completion candidates more intelligently, placing predicates with a shorter functor ahead in the candidate list.
For Sweep top-levels that use a pty (the default on Unix systems), the
top-level output now includes ANSI escape sequences that Emacs
automatically translates to text properties (colors, etc.). To have
Emacs filter out these escape sequences without applying the
corresponding text properties, set ansi-color-for-comint-mode
to the
symbol filter
.
This is a bug-fix release, addressing an issue with
sweeprolog-extract-region-to-predicate
that was introduced in
version 0.25.3. The issue prevented goal extraction from the start or
middle of right-associative binary operator chains, including ,/2
and thus affecting extraction from common conjunction chains.
The command sweeprolog-extract-region-to-predicate
now supports
extracting library(yall)
lambda terms to separate predicate
definitions. The new sweeprolog-extract-region-to-predicate
also
improves the handling of existentially quantified goals (X^Y^Goal
),
and in-clause disjunctions.
sweeprolog-extract-region-to-predicate
can now replace all occurrences of the extracted goal in the buffer
You can now invoke sweeprolog-extract-region-to-predicate
with a
prefix argument to have it check for other goals in the buffer that
are subsumed by the extracted goal, and suggest replacing them as well
with calls to the newly created predicate.
This commands lets you replace terms in the current buffer by
transforming them interactively. You can use to perform very precise
yet highly flexible code transformations. See the new manual section
“Term Replace” or type C-h f sweeprolog-query-replace-term
for more
details.
This version includes a reimplementation of the
sweeprolog-term-search
command that is both simpler and much more
performant.
Sweep now highlights the query you insert in the top-level immediately as you type it. In previous versions, query highlighting relied on a short timer, that could lead to a small delay before Sweep would update the highlighting when you change the query.
Sweep top-level buffers can now communicate with their corresponding top-level threads via a pseudo-terminal (pty) device, instead of a local TCP connection. Local TCP connections remain supported for systems where Emacs cannot use a pty, such as MS Windows. On Unix systems, top-levels now use pty by default.
Sweep Prolog mode is now compatible with the Prettify Symbols minor
mode. Prettify Symbols mode, and similar features, rely on
font-lock-add-keywords
to add highlighting patterns. Sweep does not
use Font Lock keywords for its highlighting, but now it does invoke
the relevant Font Lock keyword highlighting routines for compatibility
with minor modes such as Prettify Symbols.
Sweep now uses a slightly smaller “box” around holes to highlight them in Prolog code, such that holes are displayed with the same dimensions of any other text. This avoids small visual jitter when inserting or removing holes in a buffer.
Sweep now checks that the selected region is a goal at a callable
position, rather than a data term, before suggesting to extract the
region to a separate predicate in sweeprolog-insert-term-dwim
(M-RET
) and in the right-click context menu.
This command lets you select a part of the body of a clause and
extract it into a separate predicate. The command
sweeprolog-insert-term-dwim
(M-RET
) now invokes
sweeprolog-extract-region-to-predicate
if the region is active.
This is a maintenance release, including a rewrite of the Sweep manual in Texinfo format along with some minor bug fixes and improvements.
This version introduces a dependency of Sweep on Compat, the forward-compatibility library for Elisp available from GNU ELPA. Compat provides implementations of newer Elisp functions and features for older Emacs versions, and Sweep now makes use of it for improved backward compatibility and ease of maintenance.
This version fixes an issue that could cause Emacs to crash during certain Sweep operations if Emacs is built with Xwidgets and SWI-Prolog is built with XPCE.
In previous versions, these commands could report failure even when they in fact succeeded. This version fixes the feedback these commands provide.
Use this command to contact the Sweep maintainers directly from within Emacs. It has been documented in the manual already since version 0.6, but its implementation was unintentionally omitted.
This version of Sweep includes an overhaul of the way the completion-at-point
command (C-M-i
) works in sweeprolog-mode
buffers. Sweep now performs a more
refined analysis of the code around point when you invoke completion-at-point
to determine what kind of completion candidates to provide. This results in the
following improvements:
- Completion now works also for quoted atoms and functors
- Completion now avoids inserting parentheses and arguments after completing a
compound term when the opening parenthesis is already in place before you
invoke
completion-at-point
- Completion now takes into account the qualifying module (if any) when completing predicate calls, and suggests only predicates defined in that module
This version of Sweep adds a custom theme called sweeprolog-pce
that
mimics the highlighting of SWI-Prolog’s built-in editor, PceEmacs.
This theme obsoletes the “faces styles” feature that Sweep provided
thus far for the purpose of emulating PceEmacs highlighting.
For backward compatibility, the user option sweeprolog-faces-style
is retained for the next few versions. Also, if you have
sweeprolog-faces-style
set to light
or dark
, Sweep tries to
respect that by enabling the sweeprolog-pce
theme for you when you
first open a Prolog buffer, which should achieve the same result of
mimicking PceEmacs highlighting.
Commands that read a Prolog module name in the minibuffer now provide enhanced information about completion candidates. Namely, the annotation for documented modules now also includes the module’s one line description.
Sweep now defines a dedicated add-log-current-defun-function
for
sweeprolog-mode
buffers. This allows C-x 4 a
and related commands
to correctly identify the predicate definition at point for inclusion
in commit messages and change log entries.
This option controls if and where Sweep top-level buffers store their input history persistently. Persistent history is off by default, refer to the “Top-level History” section in the manual for more details.
This option specifies a function that is used for filtering completion
candidates in commands that prompt for a predicate. By default, it is
set to a function that hides predicates whose functor begin with the
character $
.
Sweep is now able to use the argument names from the documentation of DCG grammar rules to give more indicative names for holes when completing a DCG invocation.
The command sweeprolog-document-predicate-at-point
(C-c C-d
) now
correctly handles documenting DCG grammar rules.
This version includes an overhaul of Sweep’s treatment of DCG grammar
rules. Crucially, commands that suggest the predicate at point as a
default option now correctly recognize and format grammar rules as
such. Furthermore, sweeprolog-describe-predicate
now correctly
displays the documentation for grammar rules.
In previous versions, Sweep would change the global value of
context-menu-functions
which caused non-Prolog buffers to be
analyzed as such. This was never intended, and now Sweep only changes
context-menu-functions
locally in Prolog buffers.
Sweep now highlights and annotates DCG terminals written as quoted strings in grammar rule definitions.
The command sweeprolog-export-predicate
now exports DCG
non-terminals as such, using the F//N
notation, instead of F/N+2
.
Sweep now highlights declaration options, such as the volatile
keyword in the
following definition:
:- dynamic foo/1 as volatile.
Declaration options use the new face sweeprolog-declaration-option
.
Furthermore, Sweep now adds the help-echo
property to declaration options,
providing additional information about specific declarations on hover.
The new command sweeprolog-make-example-usage-comment
, added to Sweep in
version 0.18.2, can now be used also with Emacs 27. (The prior version of this
command relied on an Emacs function that has only been introduced in Emacs 28.)
This command, bound to C-c C-%
in sweeprolog-mode
buffers, lets
you capture and insert top-level interaction logs demonstrating your
code’s usage as source code comments. See the new “Example Usage
Comments” in the manual for more details.
SWI-Prolog recently introduced a new mechanism for using macros,
implemented in library(macros)
. Sweep now provides semantic
highlighting and tooltip information for these macros, as well as a
new command sweeprolog-expand-macro-at-point
for replacing macro
invocations with their replacements in source buffers.
Completing predicates in sweeprolog-mode
buffers now pre-filters
candidates based on the text around point, making the entire process
much faster in large projects with many defined predicates.
Sweep defines many faces for highlighting different kinds of text. In
prior versions, these faces were given names such as
sweeprolog-foo-face
. This version removes the redundant -face
suffix from all face names. (So the same face would now be called
simply sweeprolog-foo
.)
This user option determines the preferred Prolog directive to use in
sweeprolog-update-dependencies
for adding new explicit dependencies in
the buffer. See the documentation for possible values.
The format sweeprolog-update-dependencies
uses for new dependency is
modified to be more concise and similar to the format used by the
corresponding command of the SWI-Prolog built-in editor.
Buffers in sweeprolog-mode
now display an indication in the mode line
if they are loaded into the current SWI-Prolog runtime.
This version includes new commands for setting and removing
breakpoints sweeprolog-mode
buffers. See the new “Setting
Breakpoints” manual section for more information.
This version includes a fix for how the function
sweeprolog-beginning-of-top-term
handles head terms with quoted
functors (as in 'foo'(Bar) :- ...
). This function is used for finding
the beginning of Prolog clauses, and this issue affected some commands
that need to analyze the clause at point.
This user option controls what happens when you try to rename a
variable with C-c C-r
(sweeprolog-rename-variable
) to the name of
another existing variable. By default this is set to confirm
, which
causes sweeprolog-rename-variable
to notify and ask you for
confirmation is such cases.
This version include two new commands for managing numbers in Prolog
variable names, sweeprolog-increment-numbered-variables
and
sweeprolog-decrement-numbered-variables
, bound to C-c C-+
and C-c C--
respectively. See the new “Numbered Variables” manual section for
more information.
You can use the standard C-h K
and C-h F
commands to find the Info
manual node documenting a given Sweep command.
This command, bound to C-c C-r
in sweeprolog-mode
buffers,
interactively renames a variable in the current clause. You can now
also rename variables by right-clicking on them and selecting Rename
Variable
with Context Menu mode enabled.
The cross reference information that Sweep provides is enhanced to
include exact buffer positions for predicate references. In prior
versions, jumping to predicate references with M-?
(xref-find-references
) would go to the beginning of the clause which
invokes the given predicate, now it goes to the exact location of the
invocation.
This command displays the number of holes in the current
sweeprolog-mode
buffer.
You can now call sweeprolog-forward-hole
with a numeric prefix
argument (e.g. C-3 C-c TAB
) to move forward over that many holes. As a
special case, if you call it with a zero numeric argument (e.g. by
typing C-0 C-c TAB
), it invokes sweeprolog-count-holes
instead.
This change applies to sweeprolog-backward-predicate
as well.
Completing predicate calls to built-in predicates with C-M-i
(completion-at-point
) now uses the argument names from the
documentation of the predicate in the SWI-Prolog manual to name the
holes it inserts as placeholder arguments.
Sweep can now run goals in separate threads while redirecting their
output to Emacs buffers. To run goals and display their output
asynchronously, use the new command M-x sweeprolog-async-goal
(bound
to C-c C-&
in sweeprolog-mode
). Sweep uses a dedicated mode called
sweeprolog-async-goal-output-mode
which derives from compilation-mode
for the goal’s output.
This version fixes an issue where signaling newly created Prolog
Top-level threads with C-c C-c
could fail due to a race condition.
Sweep now leverages the Context Menu minor mode built into Emacs 28+
to provide right-click menus for Prolog code that give you access to
different commands depending on what you click on. You can enable
Context Menu mode with M-x context-menu-mode
.
Jumping to predicate definitions with M-.
(xref-find-definitions
) now
works also for predicates defined in source files listed in the
library index that weren’t loaded or visited yet.
In previous versions, jumping to the definition of a predicate defined
in another buffer that has recently been modified could end up placing
point in the wrong line of that buffer due to stale xref data. This
version fixes this issue, jumping to predicate definitions with M-.
now locates the current definition line also in face of recent
modifications.
sweeprolog-mode
can now annotate tokens in Prolog code with textual
descriptions that are displayed at the mouse tooltip when you hover
over different tokens in the buffer. This is done by using the
help-echo
text property. You can also display these descriptions in
the echo area with C-h .
(display-local-help
).
This is a flag controlling whether sweeprolog-mode
adds descriptions
to tokens in Prolog code via the help-echo
text property. It is set
to t
by default.
In previous versions, following an error/warning message from a buffer
that enables compilation-mode
or one of its derivatives to a
sweeprolog-mode
buffer would forcefully set the next-error-last-buffer
to the target sweeprolog-mode
buffer. That would cause further M-x
next-error
(M-g n
) invocations to jump to the next Flymake error in
that buffer, instead of going to the next error from the original
compilation-mode
buffer. This issue is fixed in this version.
The manual is also extended to cover the usage of
compilation-shell-minor-mode
in Sweep Top-level buffers.
This command can be called from anywhere to send a Prolog query to the
Sweep Top-level and show the results. In sweeprolog-mode
buffers,
it’s bound to C-c C-q
. It’s also bound to q
in sweeprolog-prefix-map
,
so if you’ve got that bound to e.g. C-c p
you can run a query with
this command from anywhere with C-c p q
.
The Sweep manual is extended with more details and useful information, and several docstrings have been tweaked.
When reading a search term in the minibuffer, sweeprolog-term-search
now populates the “future history” with the terms at point starting
from the most nested term. This means that you can type M-n
in the
minibuffer to quickly fill in the term at point in order to search for
similar terms.
Invoking sweeprolog-term-search
with a prefix argument (i.e. typing
C-u C-c C-s
) now prompts for an arbitrary Prolog goal that variables
in the search term should satisfy.
We also use a new function sweeprolog-read-term
for reading the search
term, which checks that the minibuffer contains a valid Prolog term
before exiting. If the term is invalid this function refuses to exit
the minibuffer and moves point to the position of the syntax error in
the given term.
Experimental new command, bound to C-c C-s
in sweeprolog-mode
buffers,
prompts for a Prolog term and searches for terms subsumed by it in the
current buffer. All matching terms are temporarily highlighted and
the cursor moves to the start of the next occurrence after point.
In previous versions, typing M-n
(sweeprolog-forward-predicate
) would
sometimes go to the next dynamic predicate, jumping over regular
predicates that come before it.
This user option control how C-c C-d
(sweeprolog-document-predicate-at-point
) prompts for initial
documentation information, namely argument modes, determinism
specification and predicate summary. It specifies a function that
sweeprolog-document-predicate-at-point
calls to get this information.
The default value of this option is a new function
sweeprolog-read-predicate-documentation-default-function
that
preserves the current behavior of prompting the user to insert the
needed information via the minibuffer. An alternative function that
uses holes instead is also provided, it is called
sweeprolog-read-predicate-documentation-with-holes
.
Previously, unbalanced quotes in a Prolog clause could cause Sweep to treat the entire rest of buffer as part of that clause, causing major slowdowns when inserting Prolog strings and quoted atoms in large buffers. To overcome this issue, this version introduces a mechanism for restricting analysis in such cases to the clauses surrounding the cursor.
This command, bound to C-c C-m
(or C-c RET
) in sweeprolog-mode
buffers, inserts a Prolog term at point with a given functor and
arity, using holes in place of the term’s arguments.
With non-nil indent-tabs-mode
, tabs are now used to indent lines in
Prolog code buffers.
The new command sweeprolog-infer-indent-style
can be used to update
the buffer-local values of sweeprolog-indent-offset
and
indent-tabs-mode
according to the buffer’s existing indentation style.
- Fixed issue with
sweeprolog-indent-or-forward-hole
, in previous versions it would fail to indent empty lines.
You can now use sweeprolog-align-spaces
(or cycle-spacing
in Emacs
28+) to get the “right” amount of whitespace around the cursor
position inside comments.
sweeprolog-mode
now customizes some settings related to text filling
to make auto-fill-mode
work as expected with SWI-Prolog comments.
- In previous versions, using
sweeprolog-predicate-location
on a loaded predicate would give precedence to the location from which a predicate was loaded, even if its source file has since been modified causing its location to differ. This behavior is fixed in the current version, which means thatM-.
and friends should always find the up-to-date location of predicate definitions. - Fixed possible infinite loop in
sweeprolog-beginning-of-predicate-at-point
near the beginning of the buffer. This issue could be seen by callingsweeprolog-document-predicate-at-point
(C-c C-d
) with point in the first clause of the buffer.
This version introduces a new minor mode
sweeprolog-forward-hole-on-tab-mode
, which binds TAB
to a command that
moves either indents the current line or moves to the next hole in the
buffer, in a DWIM fashion.
- Automatic indentation is improved to accommodate for DCG RHS contexts and SSU guards.
sweeprolog-identifier-at-point
now qualifies head terms with according to the current module (e.g.foo:bar/2
is returned when point is overbar(_, _)
in modulefoo
).
This allows repeating the command after the first invocation with TAB
.
Completing predicate invocations with C-M-i
(completion-at-point
) now
infers specific names for the holes inserted as argument placeholders
based on the predicate’s PlDoc
specification, when present.
Bound to C-c C-u
in sweeprolog-mode
buffers, this command analyzes the
current buffer looking for calls to implicitly autoloaded predicates,
and adds or updates autoload/2
and use_module/2
directives to make the
dependencies on these predicates explicit.
Boolean flag, when non-nil flymake
also reports implicitly autoloaded
predicates in sweeprolog-mode
buffers. Enabled by default.
Completing predicate invocations with completion-at-point
now takes
into account the number of arguments that will be implicitly added to
the created predicate call by the context, and adjusts the completion
candidates appropriately. This applies both to DCG non-terminal
bodies (where two implicit arguments are normally added to all
predicate invocations), and to meta-calls such as include(foo, L0, L)
where the sole argument of foo/1
is implicitly passed by include/3
.
Unlike other variables, occurrences of anonymous variables (_
) are no
longer highlighted when the cursor enters one, since being anonymous
they are semantically unrelated to each other.
The new command sweeprolog-plunit-testset-skeleton
, accessible from
the Sweep
menu-bar entry, inserts a template for a block of unit tests
at the location of the cursor.
- Fixed and added regression tests for an issue where
sweeprolog-beginning-of-next-top-term
would get confused by multi-line comments starting at the beginning of a line.
This is a bug-fix release, solving an issue introduced in version 0.8.12 where highlighting goals qualified with a variable module would throw an error.
sweeprolog-top-level-signal-default-goal
is now set to call the new
SWI-Prolog built-in predicate prolog_interrupt/0
. This predicate
invokes the classic SWI-Prolog top-level interrupt interface similarly
to pressing C-c
in a terminal-bound top-level.
When non-nil (the default), holes in Prolog buffers are highlighted with a dedicated face to help visually distinguishing them from regular Prolog variables.
Previously this command was only bound in sweeprolog-mode
. It is now
bound to C-c C-i
in both major modes.
Using sweeprolog-insert-term-dwim
to insert the next clause of a
module-qualified predicate definition would previously not work
correctly. This use case is now works as expected.
This version fixes an issue where the function
sweeprolog-beginning-of-next-top-term
, used by in the flymake
integration of sweeprolog-mode
, could hang when called near the end of
the buffer.
The function specified by sweeprolog-new-predicate-location-function
should now take three arguments, namely the functor, arity and neck of
the new predicate, instead of taking only the predicate indicator as a
sole argument.
Defining a previously undefined predicate with
sweeprolog-insert-term-dwim
now analyzes the context of the undefined
predicate invocation to determine if it is expected to be a DCG
non-terminal, in which case an appropriate non-terminal definition is
inserted instead of a regular predicate.
Calling sweeprolog-top-level-signal-current
(C-c C-c
in
sweeprolog-top-level
buffers) now signals the top-level thread with
the goal specified by the user option
sweeprolog-top-level-signal-default-goal
, instead of prompting for a
goal. By default this user option is set to "trace"
, causing the
top-level thread to enter trace mode. To have
sweeprolog-top-level-signal-current
prompt for a different goal
instead, call it with a prefix argument, i.e. C-u C-c C-c
.
- Fixed insertion of new clauses with
sweeprolog-insert-term-dwim
when the predicate at point is a DCG non-terminal or a predicate defined with SSU rules.sweeprolog-insert-term-dwim
now detects and inserts the correct neck (:-
,-->
or=>
) based on the previous clauses.
When completing a predicate with completion-at-point
(C-M-i
) and
choosing a predicate that takes arguments, holes are inserted is place
of each required argument.
Syntax errors that occur due to incomplete terms are no longer immediately highlighted as such.
- Fixed error in
sweeprolog-export-predicate
(C-c C-e
) in presence of exported predicates. Reported by Jan Wielemaker.
This version includes a new minor mode sweeprolog-electric-layout-mode
that adjusts whitespace around point as you type to adhere to Prolog
layout conventions.
The TCP server that accepts connections from top-level buffers is now
only started on the first invocation of sweeprolog-top-level
, instead
of being started already in sweeprolog-init
.
Syntax error highlighting is now removed more reliably when the syntax error is resolved.
sweep
’s completion at point now detects when predicate completion is
appropriate based on the context of point. If point is at a
non-callable position, atom completion is provided instead.
This user option specifies a function to be called from
sweeprolog-insert-term-dwim
when defining a new predicate to choose
the location of the new predicate definition. The default value of
the option is a function sweeprolog-default-new-predicate-location
which preserves the current behavior of placing the new predicate
right below the current predicate. Other options include the new
function sweeprolog-new-predicate-location-above-current
which places
the new predicate above the current one.
- Fixed issue where
sweeprolog-describe-predicate
would throw an error when describing predicates that were cross referenced but not loaded.
This command updates sweep
’s cross reference data for all Prolog
source files in the current project. Bound to X
in
sweeprolog-prefix-map
.
- Fixed issue where
sweeprolog-predicate-location
sometimes returned a file importing the predicate in question, rather than actually defining it. - Fixed issue where the
kill-buffer-hook
of top-level buffers would throw an error when the corresponding top-level thread already died.
- Fixed regression in variable highlighting where occurrences of the highlighted variable in adjacent clauses might have been highlighted.
- Fixed regression and added a test for clearing the syntax error face immediately when the error is fixed (e.g. a fullstop is inserted at the end of a clause).
sweeprolog-mode
now includes dedicated function for acting on
predicate definitions that span multiple clauses. The new commands
are sweeprolog-forward-predicate
and sweeprolog-backward-predicate
bound to M-n
and M-p
respectively, and sweeprolog-mark-predicate
bound
to M-h
.
The following user options and commands have been renamed to better convey their meaning:
Old symbol name | New symbol name |
---|---|
sweeprolog-colourise-buffer | sweeprolog-analyze-buffer |
sweeprolog-colourise-buffer-on-idle | sweeprolog-analyze-buffer-on-idle |
sweeprolog-colourise-buffer-max-size | sweeprolog-analyze-buffer-max-size |
sweeprolog-colourise-buffer-min-interval | sweeprolog-analyze-buffer-min-interval |
When point is preceded by a valid Prolog variable name, invoking
completion-at-point
(with C-M-i
or M-TAB
) now detects that it needs to
complete a variable name and provides other variable names that occur
in the same clause as completion candidates.
This version introduces a new mechanism for context-based term
insertion which revolves around a new command
sweeprolog-insert-term-dwim
, bound to C-M-m
. When invoked after a
fullstop ending a predicate clause, this command inserts a new clause
for the same predicate. When called with point over a call to an
undefined predicate, this command insert a definition for that
predicate after the current predicate definition.
This command, bound to C-c C-i
in sweeprolog-mode-map
, moves the
cursor and marks the next hole (placeholder variable) inserted by
sweeprolog-insert-term-dwim
for the user to fill it.
The HTML rendering sweep
performs to display Prolog documentation in
*Help*
buffers now also recognizes reference to Prolog library files,
such as library(list)
, in Prolog documentation. Clicking on such
reference opens the corresponding file from the local Prolog library.
Previously, loading sweeprolog.el
with e.g. (require 'sweeprolog)
would cause Emacs to also load sweep-module
immediately, unless the
user option sweeprolog-init-on-load
had been explicitly set by the
user to nil. This version implements lazy loading of sweep-module
,
which makes loading sweeprolog.el
a lot faster and circumvents
potential problems with byte-compiling Elisp files that depend on
sweeprolog.el
but do not have sweep-module
available at compile time.
The embedded Prolog is now loaded and initiated lazily, regardless of
the value of sweeprolog-init-on-load
, which is now obsolete.
sweep
now knows how to find and jump to the definitions of native
built-in SWI-Prolog predicates defined in C, under the condition that
the user has the SWI-Prolog sources checked out locally.
See C-h v sweeprolog-swipl-sources
and the new section “Built-in
Native Predicates” in the manual for more information about this
feature.
This version fixes some compatibility issues with Emacs versions prior
to 29 in sweeprolog-describe-predicate
. Reported by Jan Wielemaker.
Similarly to sweeprolog-describe-module
, this command renders the full
PlDoc
documentation of the specified Prolog predicate in a help-mode
buffer.
References to Prolog predicates in the *Help*
buffer produced by
sweeprolog-describe-module
and sweeprolog-describe-predicate
are now
“buttonized” such that pressing RET
on them shows the description of
the referenced predicate.
Experimental. Renders the full PlDoc
documentation of the specified
Prolog module in a help-mode
buffer.
This version includes a fix in sweeprolog-beginning-of-top-term
, which
is used to locate the beginning of the current clause. Previously
this function could hang when invoked with point before the first term
on the buffer. This affected commands that depend of this function,
such as M-x sweeprolog-document-predicate-at-point
.
sweeprolog-export-predicate
is a new command available in
sweeprolog-mode
buffers for adding the predicate defined at point to
the current module’s export list. Bound to C-c C-e
in
sweeprolog-mode-map
.
sweeprolog.el
now creates a boolean Prolog flag sweep
set to true
when
initiating Prolog, to allow users to customize their Prolog init file
accordingly.
sweeprolog.el
can now leverage flymake
to highlight and browse
diagnostics in sweeprolog-mode
buffers.
Boolean flag, enabled by default. When customized to nil,
sweeprolog-mode
integration with flymake
is disabled.
Wrapper around flymake-show-buffer-diagnostics
for sweeprolog-mode
,
bound to C-c C-`
. With a prefix argument, calls
flymake-show-project-diagnostics
instead.
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 occurrences of the =../2
(“univ”)
operator in the clause’s body.
sweeprolog-align-spaces
is a new command available in sweeprolog-mode
buffers for updating the whitespace around point according to the
SWI-Prolog convention used in if-then-else constructs where the next
token begins four columns after the start of the previous token.
In Emacs 29, when this user option is non-nil (the default),
sweeprolog-align-spaces
is added to cycle-spacing-actions
such that
pressing M-SPC
once invokes it by default.
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.
sweep
is now able to create a special buffer that contains a table of
all active top-levels, called the Top-level Menu buffer. This buffer
has its own special major mode, sweeprolog-top-level-menu-mode
, which
provides convenient commands that operate on the listed top-levels.
sweep
now includes a new command M-x sweeprolog-top-level-signal
which
prompts for a sweep
top-level buffer and a Prolog goal and signals the
specified top-level to execute the given goal. This can be used to
interrupt long running queries.
The sweeprolog-top-level-mode
major mode provides a variant of the
above command called sweeprolog-top-level-signal-current
that operates
on the top-level thread of the current buffer. This command is also
newly bound to C-c C-c
in top-level buffers.
sweeprolog-document-predicate-at-point
is a new command available in
sweeprolog-mode
buffers for interactively inserting PlDoc
documentation comments for the predicate defined at point. Bound to
C-c C-d
in sweeprolog-mode-map
.
sweeprolog.el
can now leverage eldoc
to display short documentation
for the Prolog predicate at point in sweeprolog-mode
buffers.
Boolean flag, enabled by default. When customized to nil,
sweeprolog-mode
integration with eldoc
is disabled.
sweeprolog.el
now extends auto-insert-alist
with a Prolog module
template associated with sweeprolog-mode
. The module template is
inserted into empty sweeprolog-buffers
when auto-insert-mode
is
enabled.
Loads a sweeprolog-mode
buffer. If called from a sweeprolog-mode
buffer, loads
the current buffer by default.
Follows file specifications in sweeprolog-mode
buffers.
This option controls the which style of faces will be used for
highlighting in sweeprolog-mode
buffers. Possible options are light
, dark
and default
.
This option, set by default to 4, is an integer denoting the number of
columns used as the indent increment in sweeprolog-mode
buffers.
This option is a boolean flag that determines whether to enable
automatic updating of semantic highlighting in sweeprolog-mode
buffers.
This option determines the minimum number of idle seconds that sweep
will wait before updating semantic highlighting in a sweeprolog-mode
buffer.
This option determines the maximum size of a sweeprolog-mode
buffer for
which sweep
will periodically update semantic highlighting on idle.
This option, set by default to 3, determines a minimum length for
inputs inserted into sweep
top-level history ring. The default value,
3, avoids one character top-level responses from clobbering the
history ring. This kind of inputs includes, for example, the ;
character typed to invoke backtracking.