7.17 Exporting Predicates

When you define a predicate in a Prolog mode, by default it is only visible inside that module, unless you export it by including the predicate in the export list of the defining module (the export list of a module is the second argument of the module/2 directive).

C-c C-e

Add the predicate predicate at point to the export list of the current Prolog module (sweeprolog-export-predicate).

Sweep provides a convenient command for exporting predicates that you define in Sweep Prolog mode buffers. To add the predicate near point to the export list of the current module, use the command C-c C-e (sweeprolog-export-predicate). If the current predicate is documented with a ‘PlDoc’ comment, this command adds a comment with the predicate’s mode after its name in the export list. If point is not near a predicate definition, calling sweeprolog-export-predicate prompts for a predicate to export with completion for non-exported predicates in the current buffer. To force sweeprolog-export-predicate to prompt even when point is on a predicate definition, invoke it with a prefix argument (C-u C-c C-e).

© Eshel Yaron