Subject: bug#3984:

From: Ryan <[email-masked]>
Date: Thu, 19 Sep 2013 12:23:58 -0700

On a related note, I just noticed that the 
"advice-test-called-interactively-p" test in 
test/automated/advice-tests.el happens to pass, but only because it 
doesn't use "called-interactively-p" inside the original function, but 
rather only inside the advice itself. Also, it doesn't test advising 
"call-interactively" itself. I think I will see about writing a proper 
test first, and then use that to start debugging.

On Thu Sep 19 01:06:03 2013, Ryan wrote:
> Ok, I'll work on debugging my test case tomorrow.
>
> On Wed Sep 18 20:38:48 2013, Stefan Monnier wrote:
>>> advice.  This is what "advice--called-interactively-skip" does.
>>> (Although
>>> reading through it I don't see where the bug is that prevents it
>>> recognizing
>>> the before advice in my example.)
>>
>> Exactly.  I think we need to fix this problem.  It really should work.
>>
>>> If all advised functions are wrapped by a call to the above function
>>> "wrap-function-in-indicator-lambda",
>>
>> All functions advised with a non-:around advice have such
>> a "recognizable wrapper"; and that's indeed what
>> advice--called-interactively-skip checks in
>>
>>            (and (eq (nth 1 frame2) 'apply)
>>                 (progn
>>                   (funcall get-next-frame)
>>                   (advice--p (indirect-function (nth 1 frame2)))))
>>
>> IOW the nadvice.el machinery is itself the recognizable wrapper.
>> Not sure why this fails in your test case, tho.
>>
>> For :around advices, the machinery does not provide a recognizable
>> wrapper, so we might want to add an ad-hoc wrapper like you suggest for
>> those cases, tho maybe we can avoid the cost of such a wrapper, by
>> keeping the so-advised inner-functions in a hash-table (so we can still
>> recognize them, even tho they're not tagged directly in the backtrace).
>>
>> So, I think the first thing is to figure out why your test case fails.
>>
>>
>>          Stefan