
edit.pl -- Editor interface
This module implements the generic editor interface. It consists of two extensible parts with little in between. The first part deals with translating the input into source-location, and the second with starting an editor.
edit(+Spec)- Edit indicated object. Spec is a predicate indicator, a file
specification or a source location
File:LineorFile:Line:Col. Both Line and Col count from 1, as in the messages we print, the hyperlinks we emit (see ansi_hyperlink/2) and the messages of e.g., the C compiler. Note that theline_positionof a stream (see stream_position_data/3) counts from 0.
edit- Edit associated or script file. This is the Prolog file opened by
double-clicking, the initial file loaded from the commandline using
e.g., the command below or the last file loaded into the current
session using
?- [file].,?- consult(file).or?- use_module(file).% swipl [-s] file.pl
locations(+Spec, -Locations) is det- Locate entities matching Spec. Locations is a list of pairs
Location-FullSpec, where Location is a dict holding afile, optionallineand optionallineposkeys. FullSpec is the disambiguated specification, e.g.,memberexpands to member/2 for the predicate.
locate(+Spec, -FullSpec, -Location:dict)[multifile]
locate(+Spec, -Location)[multifile]- Locate object from the specified location.
predicate_location(:Predicate, -Location) is nondet- Find the source location of a predicate.
addr2location(+Address, -File, -Line) is semidet- Get the File and Line for a C address.
edit_command(+Editor, -Command)[multifile]- This predicate should specify the shell-command called to invoke
the user's editor. The following substitutions will be made:
%e Path name of the editor %f Path name of the file to be edited %d Line number of the target
select_location(+Pairs, +UserSpec, -Location) is semidet[multifile]