11 Finding Prolog Code

The following commands let you jump to a piece of Prolog code from anywhere in Emacs:

Command: sweeprolog-find-module

Prompt for a known Prolog module and find its source code.

Command: sweeprolog-find-predicate

Prompt for a known Prolog predicate and find its source code.

sweeprolog-find-module and sweeprolog-find-predicate prompt you for a Prolog identifier (respectively, a module name or a predicate indicator), and jump to its source definition. Sweep integrates with Emacs’s standard completion API to annotate candidate modules in the completion UI with a summary line derived from their documentation, when available.

By default, these commands use the current window to display the selected module or predicate. To have it in another window instead, invoke these commands with a prefix argument (C-u M-x sweeprolog-find-predicate RET).

The command sweeprolog-find-predicate uses the function sweeprolog-read-predicate for prompting you to insert a predicate indicator in the minibuffer. This is the standard function that Sweep commands use for this purpose. It provides completion candidates based on known predicates, and it uses the predicate at point, if any, as the default minibuffer argument. By default, sweeprolog-read-predicate includes all predicates that Sweep knows about as completion candidates, except for predicates whose functor name begins with $, because that’s the convention in SWI-Prolog for internal predicates that are usually of little interest to users. To include also these predicates as completion candidates, customize the user option sweeprolog-predicate-visible-p-function to nil.