All Manuals > LispWorks User Guide and Reference Manual > 40 The LISPWORKS Package




Calls the next piece of advice associated with a function.




call-next-advice args


args are arguments to be given to the next piece of advice to be called. Any number of arguments may be given in this way, including keyword arguments, and there is no requirement for pieces of around advice to receive the same number of arguments as the original definition expected.


call-next-advice returns the values produced by the call to the next piece of advice (or to the combination of before and after advice and the original definition).


call-next-advice is the local function used to invoke the next item in the ordering of pieces of advice associated with a function. It can only be called from within the scope of the around advice. Advice may be attached to a function by defadvice and this allows the behavior of a function to be modified. Extra code to be performed before or after the function may be simply added by creating before or after advice for it. Around advice is more powerful and replaces the original definition. All the advice for a function is ordered with the around advice coming first.

The first piece of around advice receives the arguments to the function and may return any values at all. It has access to the rest of the advice, and to the original definition, by means of call-next-advice. A call to this from within the body of the around advice invokes the next piece of around advice with the arguments given to call-next-advice. The last piece of around advice in the ordering invokes the sequence of before advice, the original definition, and after advice if it calls call-next-advice. Around advice may contain any number of calls to call-next-advice, including no calls.

  1. call-next-advice is an extension to Common Lisp. See The Advice Facility for a broader discussion of advice.

call-next-advice is not like cl:call-next-method, where passing no arguments has a special meaning. To pass the same arguments to the next advice, you need something like:

(lw:defadvice (my-func my-func-advice :around)
    (a b c &rest other-args)
  (format t "my-func advice~%")
  (apply #'lw:call-next-advice a b c other-args)


(lw:defadvice (my-func my-func-advice :around)
    (&rest args)
  (format t "my-func advice~%")
  (apply #'lw:call-next-advice args)
See also


LispWorks User Guide and Reference Manual - 13 Feb 2015