~eshel/sweep

SWI-Prolog Embedded in Emacs

ELPA update via dev

18 hours ago

304aa10 Merge branch 'master'

~eshel pushed to ~eshel/sweep git

21 hours ago

#Overview

sweep is an embedding of SWI-Prolog in Emacs. It provides an interface for executing Prolog queries and consuming their results from Emacs Lisp. sweep further builds on top of this interface and on top of the standard Emacs facilities to provide advanced features for developing SWI-Prolog programs in Emacs.

#Installation

The dynamic Emacs module sweep-module and the Prolog helper library sweep.pl are included in the latest SWI-Prolog distribution. For instructions on how to build and install SWI-Prolog, see https://www.swi-prolog.org/build/.

The sweeprolog Elisp package is available on NonGNU ELPA, to install sweeprolog simply type M-x package-install RET sweeprolog RET.

An alternative to installing from ELPA is to get the Elisp library from the sweep Git repository:

  1. Clone the sweep repository:

    git clone https://git.sr.ht/~eshel/sweep
    

    Or:

    git clone https://github.com/SWI-Prolog/packages-sweep sweep
    
  2. Add sweep to the Emacs load-path:

    (add-to-list 'load-path "/path/to/sweep")
    

#Getting started

After installing the sweeprolog Elisp library, load it into Emacs:

(require 'sweeprolog)

All set! sweeprolog automatically loads sweep-module and initializes the embedded SWI-Prolog runtime.

For a full description of the different features of sweep, see the sweep manual.

Important note for Linux users: prior to version 29, Emacs would load dynamic modules in a way that is not fully compatible with the way the SWI-Prolog native library, libswipl, loads its own native extensions. This may lead to sweep failing after loading sweep-module. To work around this issue, users running Emacs 28 or earlier on Linux can start Emacs with libswipl loaded upfront via LD_PRELOAD, for example:

LD_PRELOAD=/usr/local/lib/libswipl.so emacs