This is the cl-advice Reference Manual, version 1.1.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 04:36:52 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
cl-advice
Portable advice for Common Lisp
szos at posteo dot net
LGPL
1.1.1
closer-mop
(system).
package.lisp
(file).
cl-advice.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-advice/cl-advice.lisp
package.lisp
(file).
cl-advice
(system).
*allow-implicit-conversion*
(special variable).
add-advice
(function).
advisable-function-p
(function).
advisable-lambda
(macro).
circular-advice-dependency
(condition).
define-advisory-functions
(macro).
defun-advisable
(macro).
documentation
(method).
documentation
(method).
ensure-advisable-function
(function).
ensure-unadvisable-function
(function).
implicit-conversion-to-advisable-function
(condition).
initialize-instance
(method).
initialize-instance
(method).
list-advice
(function).
make-advisable
(compiler macro).
make-advisable
(function).
make-unadvisable
(function).
remove-advice
(function).
remove-nth-advice
(function).
replace-advice
(function).
with-implicit-conversion
(macro).
with-unadvisable-function
(macro).
add-advice-after
(function).
add-advice-around
(function).
add-advice-before
(function).
advisable-function
(class).
advisable-function-after
(reader method).
(setf advisable-function-after)
(writer method).
advisable-function-arguments
(reader method).
(setf advisable-function-arguments)
(writer method).
advisable-function-around
(reader method).
(setf advisable-function-around)
(writer method).
advisable-function-before
(reader method).
(setf advisable-function-before)
(writer method).
advisable-function-initialization-error
(condition).
advisable-function-initialization-error-advisable-function
(reader method).
advisable-function-initialization-error-function
(reader method).
advisable-function-main
(reader method).
(setf advisable-function-main)
(writer method).
apply-after
(function).
apply-around
(function).
apply-before
(function).
argument-list-to-apply-list
(function).
call-with-unadvisable-function
(function).
circular-advice-advice
(reader method).
circular-advice-function
(reader method).
circular-advice-p
(function).
copy-advice
(function).
function-being-converted
(reader method).
generate-around-caller
(function).
generate-ignore-declarations
(function).
not-an-advisable-function
(condition).
not-an-advisable-function-function
(reader method).
remove-advice-all
(function).
remove-advice-if
(function).
remove-advice-if-not
(function).
remove-after-advice-if
(function).
remove-after-advice-if-not
(function).
remove-around-advice-if
(function).
remove-around-advice-if-not
(function).
remove-before-advice-if
(function).
remove-before-advice-if-not
(function).
remove-nth
(function).
remove-nth-advice-after
(function).
remove-nth-advice-around
(function).
remove-nth-advice-before
(function).
replace-advice-after
(function).
replace-advice-around
(function).
replace-advice-before
(function).
when-let1
(macro).
with-gensyms
(macro).
Packages are listed by definition order.
cl-advice
common-lisp
.
*allow-implicit-conversion*
(special variable).
add-advice
(function).
advisable-function-p
(function).
advisable-lambda
(macro).
circular-advice-dependency
(condition).
define-advisory-functions
(macro).
defun-advisable
(macro).
ensure-advisable-function
(function).
ensure-unadvisable-function
(function).
implicit-conversion-to-advisable-function
(condition).
list-advice
(function).
make-advisable
(compiler macro).
make-advisable
(function).
make-unadvisable
(function).
remove-advice
(function).
remove-nth-advice
(function).
replace-advice
(function).
with-implicit-conversion
(macro).
with-unadvisable-function
(macro).
add-advice-after
(function).
add-advice-around
(function).
add-advice-before
(function).
advisable-function
(class).
advisable-function-after
(generic reader).
(setf advisable-function-after)
(generic writer).
advisable-function-arguments
(generic reader).
(setf advisable-function-arguments)
(generic writer).
advisable-function-around
(generic reader).
(setf advisable-function-around)
(generic writer).
advisable-function-before
(generic reader).
(setf advisable-function-before)
(generic writer).
advisable-function-initialization-error
(condition).
advisable-function-initialization-error-advisable-function
(generic reader).
advisable-function-initialization-error-function
(generic reader).
advisable-function-main
(generic reader).
(setf advisable-function-main)
(generic writer).
apply-after
(function).
apply-around
(function).
apply-before
(function).
argument-list-to-apply-list
(function).
call-with-unadvisable-function
(function).
circular-advice-advice
(generic reader).
circular-advice-function
(generic reader).
circular-advice-p
(function).
copy-advice
(function).
function-being-converted
(generic reader).
generate-around-caller
(function).
generate-ignore-declarations
(function).
not-an-advisable-function
(condition).
not-an-advisable-function-function
(generic reader).
remove-advice-all
(function).
remove-advice-if
(function).
remove-advice-if-not
(function).
remove-after-advice-if
(function).
remove-after-advice-if-not
(function).
remove-around-advice-if
(function).
remove-around-advice-if-not
(function).
remove-before-advice-if
(function).
remove-before-advice-if-not
(function).
remove-nth
(function).
remove-nth-advice-after
(function).
remove-nth-advice-around
(function).
remove-nth-advice-before
(function).
replace-advice-after
(function).
replace-advice-around
(function).
replace-advice-before
(function).
when-let1
(macro).
with-gensyms
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Controls whether variables can implicitly be converted to advisable functions. When NIL implicit conversion signals an error.
Define advisable functions and add them to TO-ADVISE.
TO-ADVISE is a symbol denoting the function to advise.
NEXT-ARG is the argument prepended to the argument list of around functions.
ARGS is the argument list of TO-ADVISE, or a compatible argument list.
BODY is a set of specifications for advice functions. A specification is a list
of the shape (type forms*).
Type is either a keyword or a list. If it is a list it must conform to one of
two shapes: (keyword name &rest keyargs) or (keyword &rest keyargs). The
keyword must be one of :AROUND :BEFORE or :AFTER. If the name is a keyword then
the second shape is assumed. Otherwise the first shape is assumed. The keyargs
are passed to add-advice. If a name is given, then a function is defined using
defun, otherwise an anonymous function is used.
forms* is a set of forms comprising a function body whose argument list is ARGS, or if it is around advice, the argument list is created by (cons NEXT-ARG ARGS).
Example:
(defun foo (bar)
(print bar))
(define-advisory-functions (foo :next-arg fn) (bar)
(:before
(format t "~&before FOO, passed ~A~&" bar))
(:around
(format t "~&around foo~&")
(funcall fn bar)
(format t "~&around foo~&"))
((:after foo-after)
(format t "~&after foo, was passed ~A~&" bar)))
expands into
(progn
(apply ’add-advice
(list :before ’foo
(lambda (bar) (format t "~&before FOO, passed ~A~&" bar))))
(apply ’add-advice
(list :around ’foo
(lambda (fn bar)
(format t "~&around foo~&")
(funcall fn bar)
(format t "~&around foo~&"))))
(progn
(defun foo-after (bar) (format t "~&after foo, was passed ~A~&" bar))
(apply ’add-advice (list :after ’foo ’foo-after))))
Define a function as an advisable function - works the same as DEFUN.
Allow or disallow implicit conversions to advisable functions.
If ALLOWED-OR-NOT is :allowed then conversions are allowed, otherwise they are
disallowed.
If ABORT-ON-IMPLICIT-CONVERSION is T, a handler is established for implicit conversion errors which immediately returns RETURN-ON-ABORT.
Evaluate BODY in a context where the symbol function of FUNCTION-SYMBOL is
bound to the main function of the advisable function. The intended use of this
macro is for when access to the main function is needed, but it is undesireable
to unadvise the function in question, for example when defining methods for a
generic function which has had advice installed.
When FUNCTION-SYMBOL names an advisable function then the main function (the
advised function) is aquired and the symbol-function of FUNCTION-SYMBOL is bound
to it. BODY is then evaluated. The evaluation is body is protected with cleanup
forms which restore the symbol-function of FUNCTION-SYMBOL to refer to the
advisable function object. When RESTORE-WITH-CHANGES is T then the main function
of the advisable function object (ie the function being advised) is set to the
current symbol-function of FUNCTION-SYMBOL.
When FUNCTION-SYMBOL names an unadvisable function, then BODY is evaluated.
When FUNCTION-SYMBOL is not fbound, a continuable error of type unbound-function is signaled. In addition to the continue restart, a restart named BIND-SYMBOL-FUNCTION is established which will read and evaluate a form, and set the symbol-function of FUNCTION-SYMBOL to this form, before re-attempting to evaluate BODY within the context described above.
Add ADVICE-FUNCTION to FUNCTION. WHERE must be one of :before, :around, or :after. If ALLOW-DUPLICATES is true, advice will be added regardless. TEST is used to check if ADVICE-FUNCTION is already present. When FROM-END is true, advice will be appended instead of prepended.
Check if OBJECT is an advisable function
List advice for FN, of type TYPE. When PRINT is true, advice will be printed to standard output.
Make the function denoted by SYMBOL an advisable function.
If SYMBOL is a function argument return the advisable function generated for
it. If SYMBOL is a symbol set the symbol function of SYMBOL to the advisable
function generated.
If ARGUMENTS is provided it must be the argument list of the function being advised. When compiling this argument list will be used by the dispatching function. Otherwise if FORCE-USE-ARGUMENTS is T then eval will be used to generate the dispatcher function. Otherwise the dispatcher function will have a single &REST argument.
Make SYMBOL unadvisable if it is an advisable function.
When SYMBOL is a function object return the main function of the advisable function object. When SYMBOL is a symbol set the symbol function of SYMBOL to the main function of the advisable function object.
Remove NTH advice advice from FNs advice list of type TYPE.
Replace OLD-ADVICE with NEW-ADVICE in the advice list for FUNCTION denoted by WHERE. TEST is used to find OLD-ADVICE. IF-NOT-FOUND dictates what to do in the event OLD-ADVICE is not present. It may be one of :prepend, :append, or nil.
advisable-function
) (doctype (eql function)
)) ¶advisable-function
) (doctype (eql t)
)) ¶advisable-function
) &key dispatcher-generator force-accurate-dispatcher-arglist &allow-other-keys) ¶Set the funcallable instance function.
If DISPATCHER-GENERATOR is provided it must be a function of arity one which
will be passed the advisable function object and must return a dispatcher
function.
Otherwise if FORCE-ACCURATE-DISPATCHER-ARGLIST is T and arguments were provided,
then EVAL is used to generate a dispatcher function with the correct argument
list.
Otherwise a generic dispatcher is used which takes a rest argument.
advisable-function
) &key main &allow-other-keys) ¶Normalize the function being advised to be a function object
error
.
:function
This slot is read-only.
This function is for use a macroexpansion time. It takes an ordinary lambda list and parses it into code to generate a list suitable for use with apply
Implement WITH-ADVISABLE-FUNCTIONs logic. FUNCTION-SYMBOL has its symbol function bound to the main function of the advisable function object that FUNCTION-SYMBOL currently refers to. Then THUNK is called, and finally the original advisable function is restored. If FUNCTION-SYMBOL names an unadvisable function then thunk is called.
check if theres a circular dependency between FUNCTION and ADVICE-FN.
DESTRUCTIVELY Copy all advice from FN1 to FN2
advisable-function
)) ¶automatically generated reader method
advisable-function
)) ¶automatically generated writer method
advisable-function
)) ¶automatically generated reader method
advisable-function
)) ¶automatically generated writer method
advisable-function
)) ¶automatically generated reader method
advisable-function
)) ¶automatically generated writer method
advisable-function
)) ¶automatically generated reader method
advisable-function
)) ¶automatically generated writer method
advisable-function-initialization-error
)) ¶advisable-function-initialization-error
)) ¶advisable-function
)) ¶automatically generated reader method
main
.
advisable-function
)) ¶automatically generated writer method
main
.
circular-advice-dependency
)) ¶f2
.
circular-advice-dependency
)) ¶f1
.
implicit-conversion-to-advisable-function
)) ¶not-an-advisable-function
)) ¶fn
.
error
.
:function
This slot is read-only.
funcallable-standard-object
.
(setf advisable-function-after)
.
advisable-function-after
.
(setf advisable-function-arguments)
.
advisable-function-arguments
.
(setf advisable-function-around)
.
advisable-function-around
.
(setf advisable-function-before)
.
advisable-function-before
.
(setf advisable-function-main)
.
advisable-function-main
.
documentation
.
documentation
.
initialize-instance
.
initialize-instance
.
:arguments
:before
:around
:after
Jump to: | (
A C D E F G I L M N R W |
---|
Jump to: | (
A C D E F G I L M N R W |
---|
Jump to: | *
A B F M S |
---|
Jump to: | *
A B F M S |
---|
Jump to: | A C F I N P S |
---|
Jump to: | A C F I N P S |
---|