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

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

Re: Advice function needs argument not used in function, how to avoid co


From: Michael Heerdegen
Subject: Re: Advice function needs argument not used in function, how to avoid compiler warning?
Date: Thu, 06 Oct 2022 00:30:28 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Jean Louis <bugs@gnu.support> writes:

> I realize that advice function need argument such as &rest args, but I
> am not using it in the function. And I do not understand what is that
> argument receiving. Anybody may explain it?
>
> I have to do (ignore args) to avoid compiler warning. What does args
> receive?

The arguments of the current call of the advised function, in the case
of an :after advice.  In the general case that depends on the kind of
advice (see docstring of `advice-add', the HOW arg).

> (defun hyperscope-after-sort (&rest args)
>   (ignore args)
>   (hyperscope-highlight))

You can just use `_args` to label the argument as unused by the function
body - it's the same as for all functions.

Michael.




reply via email to

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