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

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

bug#3984:


From: Ryan
Subject: bug#3984:
Date: Wed, 18 Sep 2013 16:30:44 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8

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





reply via email to

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