GNU bug report logs -
#3984
23.0.96; defadvice of call-interactively defeats interactive-p
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Thu, 30 Jul 2009 22:45:04 UTC
Severity: minor
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #96 received at 3984 <at> debbugs.gnu.org (full text, mbox):
Ok, I figured out how to walk down the stack, identify which frames are
calls to advised functions, and for each call to an advised function,
find the position in the stack of the call to the original function
definition, using the functions in nadvice.el. First, we define:
(defun unadvised-function (func)
"Return the original function definition of FUNC before it was advised."
(let ((func (indirect-function func)))
(while (advice--p func)
(setq func (advice--cdr func)))
func))
Then we scan down the stack starting from the very earliest function
call, looking for functions that are advised (via "advice--p"). Every
time we find ad advised function, we use get the original definition via
unadvised-function and then search down the stack for a call to that
original definition. Then we know to skip all those frames when
searching for called-interactively. Specifically, we skip everything but
the call to the outermost advice, since that call will bear the original
name of the function.
Again, though, this requires a top-down non-lazy search of the stack,
which is possible but seems to go against the intentions of the current
implementation that checks frames one-by-one.
What do you think? I'd be happy to work on an implementation of this in
the next few days if you think it's worth pursuing. But if so, I could
use your input on the isue of the top-down search.
-Ryan
This bug report was last modified 11 years and 243 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.