help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help setting nadvice for indent-region


From: Michael Heerdegen
Subject: Re: Help setting nadvice for indent-region
Date: Thu, 11 Feb 2016 20:14:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.90 (gnu/linux)

Kaushal Modi <kaushal.modi@gmail.com> writes:

> But what should be the return value of an :around advice fn?

The around advice function should return the value you want the adviced
function to return.  This will very often be the value gotten by
applying the original function (aka "don't change the return value"), or
a value derived from it.  Or something completely different.  The
advised function will return just this value as well.  The around advice
works like this:

  (lambda (&rest r) (apply FUNCTION OLDFUN r))

where FUNCTION is the advice defined.  As you see, the combined call has
the call of FUNCTION at the outermost level.

When several advices are in effect, the order is significant.

But note that this is not the case for all advice types.

Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]