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: Fri, 12 Feb 2016 14:57:26 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.90 (gnu/linux)

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

> Things became clear after I added this debug statement:
>
>  (message "Args: %S use-region-p: %S" args (use-region-p))
>
> In any case, I will be going the right way of advising this as Stefan
> and you advised. Now I only need to figure out how not to print that
> message when doing eval-defun.

If it's only for debugging anyway, and you want to message that only
when your advice comes into play, I suggest to move that call to the
interactive part as well.

> > The around advice function should return the value you want the
> > advised function
> to return.
>
> Thank you! So with a let-bound variable 'ret', I can have something like
>
> (setq ret (apply orig-fn args))
>
> and return 'ret' at the end of the :around advice function definition.
> Right?

Sure.

It's just a matter of style (i.e. a more functional vs. a more
imperative programming style).


Regards,

Michael.




reply via email to

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