Next: text.gap-buffer
- Gap buffer, Previous: text.edn
- EDN parsing and construction, Up: Library modules - Utilities [Contents][Index]
text.external-editor
- Running external editorA convenience module to invoke external editor program. This is mainly to be used from REPL, but can be useful for other purposes.
{text.external-editor} Starts an external editor. The editor program path is determined in the following order:
*editor*
in the user module, if defined.
GAUCHE_EDITOR
.
EDITOR
.
#f
Just returns #f
.
error
Throws an error.
ask
Asks the user. (default)
message
Prints message and returns #f
.
Returns #t
for normal termination.
The editor program may be called in one of the following way:
EDITOR filename EDITOR +lineno filename
The latter expects to locate the cursor on the specified line number in the filename.
The file to open is determined by calling the generic function
ed-pick-file
on the argument path-or-proc.
It should return (filename lineno)
,
or #f
to indicate that it couldn’t determine the file to edit.
Methods for <string>
and <procedure>
are already defined;
see the entry of ed-pick-file
below.
The load-after argument controls whether the file is loaded into the process after the file is modified. It must be one of the following values:
#t
Load the file once editor exits and the file is modified.
#f
Do not load the file.
ask
Ask the user if the file should be loaded or not if the file is modified. (default)
NB: Common Lisp’s ed
can be invoked without argument. For our usage,
though, that feature doesn’t seem too useful—it’s more likely that
repl IS inside an editor so we only need to open a specific file in
a buffer. Emacsclient requires filename, so it further complicates things.
For now we just require one argument.
{text.external-editor}
Invoke an external editor (as described in ed
) on a temporary file
whose content is string.
Once editor exits, returns the edited content as a string.
{text.external-editor}
Determine what to edit. It must return a list of
filename and line number, or #f
if it can’t find appropriate file to
edit.
Methods for strings, procedures and <top>
are already defined.
If obj is a string, it is taken as a filename.
If obj is a procedure and its source location is available,
the source file and the location is returned.
Otherwise, #f
is returned.
Next: text.gap-buffer
- Gap buffer, Previous: text.edn
- EDN parsing and construction, Up: Library modules - Utilities [Contents][Index]