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: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.
edit- Edit associated or script file. This is the Prolog file opened
by double-clicking or the file loaded using
% 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 a file,
optional line and optional linepos keys. FullSpec is the
disambiguated specification, e.g., member expands to member/2
for the predicate.
locate(+Spec, -FullSpec, -Location:dict)[multifile]
is_file_search_spec(@Spec) is semidet[private]- True if Spec is valid pattern for absolute_file_name/3.
find_source(++FileSpec, =File) is semidet[private]- Find a source file from FileSpec. If FileSpec resolves to a .qlf
file, File is the embedded `.pl` file (which may not exist).
locate(+Spec, -Location)[multifile]- Locate object from the specified location.
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. |
addr2location(+Address, -File, -Line) is semidet- Get the File and Line for a C address.
do_edit_source(+Location)[private]- Actually call the editor to edit Location, a list of Name(Value)
that contains
file(File) and may contain line(Line). First the
multifile hook edit_source/1 is called. If this fails the system
checks for XPCE and the prolog-flag editor. If the latter is
built_in or pce_emacs, it will start PceEmacs.
Finally, it will get the editor to use from the prolog-flag
editor and use edit_command/2 to determine how this editor
should be called.
run_pce_emacs(+URL) is semidet[private]- Dynamically load and run emacs/1.
editor(-Editor)[private]- Determine the external editor to run.
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]-
- Arguments:
-
| Pairs | - is a list of Location-Spec pairs |
| Location | - is a list of properties |
existing_location(+Location) is semidet[private]- True when Location can be edited. By default that means that the
file exists. This facility is hooked to allow for alternative ways
to reach the source, e.g., by lazily downloading it.
read_number(+Max, -X) is semidet[private]- Read a number between 1 and Max. If Max < 10, use get_single_char/1.
short_filename(+Path, -Spec) is det[private]- Spec is a way to refer to the file Path that is shorter. The path is
shortened by either taking it relative to the current working
directory or use one of the Prolog path aliases.