From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ryan Newsgroups: gmane.emacs.bugs Subject: bug#3984: Date: Wed, 18 Sep 2013 16:30:44 -0700 Message-ID: <523A37A4.5060505@thompsonclan.org> References: <20E00C7675E64356BF2F0B2A7E0ABDB1@us.oracle.com> <5232D333.8030206@thompsonclan.org> <523359CD.2070904@thompsonclan.org> <5233670E.4030703@thompsonclan.org> <5237C9FF.1000809@thompsonclan.org> <52388FEB.6020007@thompsonclan.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1379547081 5815 80.91.229.3 (18 Sep 2013 23:31:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Sep 2013 23:31:21 +0000 (UTC) Cc: 3984@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 19 01:31:23 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VMRDO-0007hz-LK for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Sep 2013 01:31:22 +0200 Original-Received: from localhost ([::1]:49029 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMRDO-0000va-7L for geb-bug-gnu-emacs@m.gmane.org; Wed, 18 Sep 2013 19:31:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40834) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMRDE-0000vR-Gr for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2013 19:31:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMRD7-0003Zc-7A for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2013 19:31:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMRD7-0003ZR-3W for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2013 19:31:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VMRD4-0003cq-3Z for bug-gnu-emacs@gnu.org; Wed, 18 Sep 2013 19:31:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ryan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Sep 2013 23:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 3984 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 3984-submit@debbugs.gnu.org id=B3984.137954706013928 (code B ref 3984); Wed, 18 Sep 2013 23:31:02 +0000 Original-Received: (at 3984) by debbugs.gnu.org; 18 Sep 2013 23:31:00 +0000 Original-Received: from localhost ([127.0.0.1]:47644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMRD0-0003cZ-PX for submit@debbugs.gnu.org; Wed, 18 Sep 2013 19:30:59 -0400 Original-Received: from mail-pd0-f182.google.com ([209.85.192.182]:35582) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMRCx-0003cH-LW for 3984@debbugs.gnu.org; Wed, 18 Sep 2013 19:30:56 -0400 Original-Received: by mail-pd0-f182.google.com with SMTP id r10so7684000pdi.41 for <3984@debbugs.gnu.org>; Wed, 18 Sep 2013 16:30:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=pcqVL72aZnMUek/ccS3+uZHMz0RDE+Kk+0GYryjyL5k=; b=Q+NLfONXCPhtOwUv0gY89zNrGMATeAyU8dsVNU/AxMfMZYQbw+R9ckg6gEXmqaObKn 5Ay/cLTfCSngIdbZeBIuRFjlxUBgx/xASDTZuGdcJeh27JNl0M/KE5WjmCX7LGn5Hxnx xepN5jmkBX/eJRaBRUFXASRsb34wCUX9jUWRvBtGvX0wg/O8RKB3VlGdfbBVV++nwm1I ++MJ17Syf9qvDSGWhMrSwFNoXR7K22QbFe2dxkvsq6w4Cel1F3mRRJy2T3XP765j5brm RA82euLr7PGqAlypOqRcjwR9Yv3Js5DmA/NZSybT9tW176fH5zCmyNqA/8bbDpNXSQQi 0NpQ== X-Gm-Message-State: ALoCoQlLXBNaeCAWdDYoBbT/GLWwTgcXzuq1Lj76/r5imlXlrDoiRtyiElheEPQ2t40fk9kkp/e8 X-Received: by 10.67.23.199 with SMTP id ic7mr46059412pad.73.1379547049514; Wed, 18 Sep 2013 16:30:49 -0700 (PDT) Original-Received: from wireless-121-195.scripps.edu (wireless-121-195.scripps.edu. [137.131.121.195]) by mx.google.com with ESMTPSA id ta10sm7844353pab.5.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Sep 2013 16:30:48 -0700 (PDT) User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:78540 Archived-At: 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