Next: ギャップバッファ, Previous: EDNのパーズと構築, Up: ライブラリモジュール - ユーティリティ [Contents][Index]
text.external-editor
- 外部エディタの起動A 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.
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 a generic function ed-pick-file
.
It should return (filename lineno)
,
or #f
to indicate that it couldn’t determine the file to edit.
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.
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
) with string
being the initial content. 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.
Methos 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: ギャップバッファ, Previous: EDNのパーズと構築, Up: ライブラリモジュール - ユーティリティ [Contents][Index]