[Top][All Lists]

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

Re: How to get advised function name form inside of the advice

From: Marcin Borkowski
Subject: Re: How to get advised function name form inside of the advice
Date: Fri, 04 Mar 2016 19:32:23 +0100
User-agent: mu4e 0.9.13; emacs

On 2016-03-04, at 17:56, Vitalie Spinu <address@hidden> wrote:

>>> On Fri, Mar 04 2016 15:16, Marcin Borkowski wrote:
>> On 2016-03-04, at 14:36, Vitalie Spinu <address@hidden> wrote:
>>> Hi,
>>> How to retrieve the name of the original function from the inside of "new"
>>> advice? I need to condition-case a function and show a meaningful error 
>>> message
>>> with function name instead of an error.
>> It seems that you can't do that (and for good reasons).  See here:
>> https://lists.gnu.org/archive/html/help-gnu-emacs/2016-02/msg00218.html
> Hm, I thought so. Thanks.
> What are those good reasons though? I don't see any reasons given in that
> thread.

Because they are not given there.  The main reason is: this is Lisp,
a function can have one name, a few names (neither of which is "main" or
"canonical"), or no name.

> I think my use case is a good reason to have such a feature. Otherwise one 
> would
> need a macro to define separate advice function per advice or pass a closure 
> as
> an advice. Both ways are overkill for such a basic requirement.

This is exactly what I have done.  See here:
for my approach (including a stupid mistake of using `make-symbol'
instead if `intern', promptly corrected by Michael H.)

>  Vitalie


Marcin Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University

reply via email to

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