Ann: Sweep (new Emacs interface) version 0.6.0

Hi all,
Some updates regarding sweep:

As a reminder, sweep is a new GNU Emacs interface for working with SWI-Prolog code. See the initial Discourse thread introducing sweep and the sweep manual for more background.

First and foremost, thanks to an update from @jan to the SWI-Prolog build process for Windows, sweep is available also for Windows users!
To get started with sweep on Windows, grab the latest SWI-Prolog build for Windows and a copy of Emacs (the official installer can be found here), then type in Emacs M-x package-install RET sweeprolog RET to install sweep’s Emacs Lisp library.
Lastly, open a Prolog file and type M-x sweeprolog-mode and you should be good to go. To access the sweep manual from within Emacs, type C-h i d m sweep RET.

Screenshot of Windows 11 running Emacs 28.2 with sweep

We also have some newly added features:


Added integration with Flymake

sweeprolog.el can now leverage flymake, the standard
Emacs on-the-fly code diagnostics interface, to highlight
and browse diagnostics in sweeprolog-mode buffers.

New user option sweeprolog-enable-flymake

Boolean flag, enabled by default. When customized to nil,
sweeprolog-mode integration with flymake is disabled.

New command sweeprolog-show-diagnostics

Wrapper around flymake-show-buffer-diagnostics for sweeprolog-mode,
bound to C-c C-`. With a prefix argument, calls
flymake-show-project-diagnostics instead.

Fixed bug in end of a clause detection in presence of =..

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.

Fixed issue with loading sweep-module from a directory with spaces in its name

New command sweeprolog-align-spaces in sweeprolog-mode buffers

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.

New user option sweeprolog-enable-cycle-spacing

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.

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. Reported by @jan.

New special buffer for listing and working with multiple top-levels

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.

New commands for interrupting running 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.

New command sweeprolog-document-predicate-at-point in sweeprolog-mode 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.

Added integration with eldoc

sweeprolog.el can now leverage eldoc, the standard
Emacs on-the-fly code documentation interface, to display short documentation
for the Prolog predicate at point in sweeprolog-mode buffers.

New user option sweeprolog-enable-eldoc

Boolean flag, enabled by default. When customized to nil,
sweeprolog-mode integration with eldoc is disabled.


2 Likes