mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2025-12-06 02:40:26 -08:00
Add tests and documentation for ed hooks
This commit is contained in:
parent
c0e56f23af
commit
cb750d37d6
3 changed files with 37 additions and 0 deletions
|
|
@ -28,6 +28,8 @@
|
|||
parameter given to configure script).
|
||||
|
||||
* Pending changes since 21.2.1
|
||||
** Enhancements
|
||||
- Add hook functions for cl:ed via ext:*ed-functions* list
|
||||
* 21.2.1 changes since 20.4.24
|
||||
** Announcement
|
||||
Dear Community,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
@node Environment - Dictionary
|
||||
@subsection Dictionary
|
||||
@lspindex disassemble
|
||||
@lspindex ed
|
||||
@lspindex trace
|
||||
|
||||
@defun disassemble function-designator*
|
||||
|
|
@ -29,6 +30,23 @@ ECL only has a particular difference: it has two different compilers, one based
|
|||
@end itemize
|
||||
@end defun
|
||||
|
||||
@defun ed x?
|
||||
Invoke an editor on the file or object specified by @var{x}.
|
||||
@paragraph Synopsis
|
||||
(ed @var{x?})
|
||||
@table @var
|
||||
@item x
|
||||
@code{nil}, a file path, or an object to edit.
|
||||
@end table
|
||||
|
||||
@paragraph Description
|
||||
Starts the editor (on a file or an object if named). Functions from the list @var{ext:*ed-functions*} are called in order with @var{x} as an argument until one of them returns non-@code{nil}; these functions are responsible for signalling a @code{file-error} to indicate failure to perform an operation on the file system. If no function returns a non-@code{nil} value or @var{ext:*ed-functions*} is @code{nil} then a @code{simple-error} will be signalled.
|
||||
|
||||
The Common Lisp specification states that the @var{x} argument is either @code{nil}, a function name, or an instance of @var{string} or @var{pathname} and that a @var{type-error} may be signalled if is not one of these types. ECL does not check the type of @var{x} and thus permits any object to be passed to the hook functions. This allows for the possibility of editing other objects that have a representation in source code such as class definitions. Therefore, the hook functions should not make any assumptions about the type of @var{x} and should instead return @code{nil} if there is not an approriate edit method for a specific value of @var{x}.
|
||||
|
||||
By default @var{ext:*ed-functions*} contains a single function that attempts to run the program named in the environment variable @code{EDITOR}. If this environment variable is not set then the fallback program is @code{vi}.
|
||||
@end defun
|
||||
|
||||
@defmac trace function-name*
|
||||
Follow the execution of functions
|
||||
@paragraph Synopsis
|
||||
|
|
|
|||
|
|
@ -378,3 +378,20 @@
|
|||
(setf stream-var inner-stream-var)
|
||||
(is (open-stream-p stream-var)))
|
||||
(is (not (open-stream-p stream-var)))))
|
||||
|
||||
;;;; Author: Tarn W. Burton
|
||||
;;;; Created: 2021-06-05
|
||||
;;;; Contains: *ed-functions* tests
|
||||
(test mix.0020.ed-functions
|
||||
(let ((ext:*ed-functions* (list (lambda (x)
|
||||
(equal x "foo"))
|
||||
(lambda (x)
|
||||
(equal x "bar"))
|
||||
(lambda (x)
|
||||
(when (equal x "baz")
|
||||
(error 'file-error :pathname x))))))
|
||||
(is (ed "foo"))
|
||||
(is (ed "bar"))
|
||||
(signals simple-error (ed "qux"))
|
||||
(signals file-error (ed "baz"))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue