Ann: sweep (Emacs interface) version 0.8.0

Hey all,

Version 0.8.0 of sweep, the SWI-Prolog Emacs integration package, is out and available for installation with M-x package-install sweeprolog (or M-x package-update sweeprolog) inside Emacs.

The most important changes since my previous update are summarized below:

New command sweeprolog-insert-term-dwim in sweeprolog-mode

Experimental. 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 inserts a definition for that
predicate after the current predicate definition.

New command sweeprolog-forward-hole in sweeprolog-mode

This is a companion command for sweeprolog-insert-term-dwim, bound to C-c C-i in sweeprolog-mode buffers. This command moves the cursor and marks the next “hole” (placeholder variable) inserted by sweeprolog-insert-term-dwim for the user to fill it.

sweep-module is now loaded on-demand

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.

Deprecated user option sweeprolog-init-on-load

The embedded Prolog is now loaded and initiated lazily, regardless of
the value of sweeprolog-init-on-load, which is now obsolete.

Jumping to source works also for built-in predicates defined in C

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.

New command sweeprolog-describe-module

This command prompts for a SWI-Prolog module name and renders the full PlDoc documentation of the specified module in a hyperlinked Emacs help-mode buffer.

New command sweeprolog-describe-predicate

Similarly to sweeprolog-describe-module, this command renders the full
PlDoc documentation of the specified Prolog predicate in a help-mode
buffer.

New command sweeprolog-export-predicate in sweeprolog-mode

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.

Added a Prolog flag indicating the Prolog is running under sweep

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.


For more details, see the sweep manual by visiting sweep: SWI-Prolog Embedded in Emacs or by typing C-h i d m sweep in Emacs.


Comments, requests, bug reports and the like are very welcome :slight_smile:

3 Likes