Sweep defines the foreign Prolog predicates sweep_funcall/2
and
sweep_funcall/3
, that you can use for calling Elisp functions
from Prolog code. You can only call these predicates in the context
of a Prolog query initiated by sweeprolog-open-query
, meaning
that they only work in the main Prolog thread (which is also Emacs’s
main thread). The first argument to these predicates is a Prolog
string holding the name of the Elisp function to call. The last
argument to these predicates is unified with the return value of the
Elisp function, represented as a Prolog term (see Conversion of Elisp objects to Prolog terms). sweep_funcall/3
converts its second argument to an
Elisp object (see Conversion of Prolog terms to Elisp objects) and passes it as a sole
argument to the Elisp function it invokes. The sweep_funcall/2
variant invokes the Elisp function without any arguments.