From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#3984: Fix for #3984 Date: Fri, 13 Sep 2013 17:02:38 -0400 Message-ID: References: <20E00C7675E64356BF2F0B2A7E0ABDB1@us.oracle.com> <5232D333.8030206@thompsonclan.org> <523359CD.2070904@thompsonclan.org> <5233670E.4030703@thompsonclan.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1379106201 22011 80.91.229.3 (13 Sep 2013 21:03:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Sep 2013 21:03:21 +0000 (UTC) Cc: 3984@debbugs.gnu.org To: Ryan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 13 23:03: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 1VKaWQ-0005S0-EB for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Sep 2013 23:03:22 +0200 Original-Received: from localhost ([::1]:51241 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKaWP-0003zS-S6 for geb-bug-gnu-emacs@m.gmane.org; Fri, 13 Sep 2013 17:03:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKaWF-0003vc-GQ for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2013 17:03:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VKaW7-0008Oq-2B for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2013 17:03:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54662) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VKaW6-0008OY-VO for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2013 17:03:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VKaW6-0003aM-Eq for bug-gnu-emacs@gnu.org; Fri, 13 Sep 2013 17:03:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Sep 2013 21:03: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.137910616713754 (code B ref 3984); Fri, 13 Sep 2013 21:03:02 +0000 Original-Received: (at 3984) by debbugs.gnu.org; 13 Sep 2013 21:02:47 +0000 Original-Received: from localhost ([127.0.0.1]:34722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VKaVr-0003Zl-41 for submit@debbugs.gnu.org; Fri, 13 Sep 2013 17:02:47 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:28102) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VKaVo-0003ZX-Dj for 3984@debbugs.gnu.org; Fri, 13 Sep 2013 17:02:44 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFG4rxBo/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2NGYNxA6R6gV6DE4FK X-IPAS-Result: Av4EABK/CFG4rxBo/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2NGYNxA6R6gV6DE4FK X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="27686455" Original-Received: from 184-175-16-104.dsl.teksavvy.com (HELO pastel.home) ([184.175.16.104]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 13 Sep 2013 16:59:04 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 2810562CB9; Fri, 13 Sep 2013 17:02:38 -0400 (EDT) In-Reply-To: <5233670E.4030703@thompsonclan.org> (Ryan's message of "Fri, 13 Sep 2013 12:27:10 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) 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:78371 Archived-At: >> Looking at the code in trunk, I see that there is a special hook for >> functions to decide which stack frames to skip over when looking for >> call-interactively. I still think they should relax the test for >> equality to "equal indirect-functions" instead of exactly the symbol >> call-interactively. The code does check "equal modulo indirect-functions" in some cases, but indeed not all. I don't think that replacing the equality check against `call-interactively' with a check modulo indirect-functions would solve your problem, tho (that only helps when calling though an alias of call-interactively, but here the relevant stack frame will be a call to the # which is not equal-modulo-indirect-functions to call-interactively since call-interactively has been redefined to a different functions by the advice). You can probably use called-interactively-p-functions to detect the # and skip the frames between it and the corresponding call to `call-interactively'. But if you find a cute patch against the current code which makes it work for you in a cleanish way, do send it here, to see if it can be included. > Actually, I just noticed that in trunk, nadvice.el adds a function to > "called-interactively-p-functions" to skip advice-related stack frames, but > this works only for advice on the interactive function, not advice defined > on call-interactively itself. Indeed. It doesn't even work for all advices (more specifically it doesn't work for :around advices, which means it doesn't work for advices defined via `defadvice' since these all turn into one big :around "new advice"). > Furthermore, from my limited testing it appears that the structure of > the call stack for advised functions has changes significantly in > trunk, making my code obsolete. Indeed, the implementation of advices has been completely changed. > The whole thing looks like a work in progress right now. There's no planned change to it, so I consider it "ready modulo bug-reports". AFAIK it works "at least as well as before" (it works better than before in the sense that Edebugging a function with calls to called-interactively-p should now work correctly). `called-interactively-p' is a big ugly hack and only works sometimes. It can break in all kinds of cases (e.g. it currently won't work in byte-compiled lexical-binding code within a `catch', or a `condition-case', or the unwind part of an `unwind-protect'). Also, the functions called (non-interactively, obviously) by your `call-interactively' advice will probably think that they're called interactively (hopefully your advice doesn't call many functions, and hopefully none of them cares whether it's called interactively or not). Stefan