Did you know ... | Search Documentation: |
Customizing the editor interface |
The predicates described in this section are hooks that can be defined to disambiguate specifications given to edit/1, find the related source, and open an editor at the given source location.
file(Path)
or Name/Arity.
Location is a list of attributes of the location.
Normally, this list will contain the term file(File)
and,
if available, the term line(Line)
.
If it fails, edit/1
uses its internal defaults, which are defined by the Prolog flag editor
and/or the environment variable
EDITOR
. The following rules apply. If the Prolog flag editor
is of the format $
<name>, the editor is
determined by the environment variable <name>. Else, if
this flag is pce_emacs
or built_in
and XPCE is loaded or can be loaded, the built-in Emacs clone
is used. Else, if the environment EDITOR
is set, this
editor is used. Finally,
vi is used as default on Unix systems and notepad on
Windows.
See the default user preferences file customize/init.pl
for examples.
.exe
)
extension. Command is an atom describing the command. The
following %-sequences are replaced in Command before the
result is handed to shell/1:
%e | Replaced by the (OS) command name of the editor |
%f | Replaced by the (OS) full path name of the file |
%d | Replaced by the line number |
If the editor can deal with starting at a specified line, two clauses should be provided. The first pattern invokes the editor with a line number, while the second is used if the line number is unknown.
The default contains definitions for vi, emacs, emacsclient, vim, notepad^* and wordpad^*. Starred editors do not provide starting at a given line number.
Please contribute your specifications to bugs@swi-prolog.org.
library(swi_edit)
,
containing definitions to locate classes and methods as well as to bind
this package to the PceEmacs built-in editor.
:- multifile prolog_edit:load/0. prolog_edit:load :- ensure_loaded(library(swi_edit)).