next up previous
Next: Verify Type of Up: Built-In Predicates Previous: Quick Load Files

Listing Predicates and Editor Interface

 

SWI-Prolog offers an interface to the Unix vi editor (vi(1)), Richard O'Keefe's top editor [O'Keefe, 1985] and the GNU-EMACS invocations emacs and emacsclient. Which editor is used is determined by the Unix environment variable EDITOR , which should hold the full pathname of the editor. If this variable is not defined, vi(1) is used.

After the user quits the editor make/0 is invoked to reload all modified source files using consult/1. If the editor can be quit such that an exit status non-equal to 0 is returned make/0 will not be invoked. top can do this by typing control-C, vi cannot do this.

A predicate specification is either a term with the same functor and arity as the predicate wanted, a term of the form Functor/Arity or a single atom. In the latter case the database is searched for a predicate of this name and arbitrary arity (see current_predicate/2). When more than one such predicate exists the system will prompt for confirmation on each of the matched predicates. Predicates specifications are given to the `Do What I Mean' system (see dwim_predicate/2) if the requested predicate does not exist.

ed( +Pred)

  Invoke the user's preferred editor on the source file of Pred, providing a search specification which searches for the predicate at the start of a line.
ed

  Invoke ed/1 on the predicate last edited using ed/1. Asks the user to confirm before starting the editor.
edit( +File)

  Invoke the user's preferred editor on File. File is a file specification as for consult/1 (but not a list). Note that the file should exist.
edit

  Invoke edit/1 on the file last edited using edit/1. Asks the user to confirm before starting the editor.
listing( +Pred)

  List specified predicates (when an atom is given all predicates with this name will be listed). The listing is produced on the basis of the internal representation, thus loosing user's layout and variable name information. See also portray_clause/1.
listing

  List all predicates of the database using listing/1.
portray_clause( +Clause)

  Pretty print a clause as good as we can. A clause should be specified as a term `Head :- Body ' (put brackets around it to avoid operator precedence problems). Facts are represented as `Head :- true '.



next up previous
Next: Verify Type of Up: Built-In Predicates Previous: Quick Load Files



Passani Luca
Tue Nov 14 08:58:33 MET 1995