Did you know ... Search Documentation:
edit.pl -- Editor interface
PublicShow source

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.

Source edit(+Spec)
Edit indicated object. Spec is a predicate indicator, a file specification or a source location File:Line or File: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 the line_position of a stream (see stream_position_data/3) counts from 0.
Source 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
Source locations(+Spec, -Locations) is det
Locate entities matching Spec. Locations is a list of pairs Location-FullSpec, where Location is a dict holding a file, optional line and optional linepos keys. FullSpec is the disambiguated specification, e.g., member expands to member/2 for the predicate.
Source locate(+Spec, -FullSpec, -Location:dict)[multifile]
Source locate(+Spec, -Location)[multifile]
Locate object from the specified location.
Source predicate_location(:Predicate, -Location) is nondet
Find the source location of a predicate.
Arguments:
Predicate- is a qualified head. The module may be unbound at entry. It will be bound to the actual implementation module.
Source addr2location(+Address, -File, -Line) is semidet
Get the File and Line for a C address.
Source 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:
%ePath name of the editor
%fPath name of the file to be edited
%dLine number of the target
Source select_location(+Pairs, +UserSpec, -Location) is semidet[multifile]
Arguments:
Pairs- is a list of Location-Spec pairs
Location- is a list of properties