From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.bugs Subject: bug#14702: 24.3.50; Byte-compiling called-interactively-p inside catch Date: Tue, 25 Jun 2013 15:56:13 +0200 Message-ID: <87obaujnuq.fsf@rosalinde.fritz.box> References: <87zjufd1ks.fsf@rosalinde.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1372168646 4688 80.91.229.3 (25 Jun 2013 13:57:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Jun 2013 13:57:26 +0000 (UTC) Cc: 14702@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jun 25 15:57:26 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 1UrTkK-0006OB-3R for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2013 15:57:24 +0200 Original-Received: from localhost ([::1]:55009 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrTkJ-0004Ee-Q9 for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Jun 2013 09:57:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrTk7-0003zK-CT for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2013 09:57:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UrTk2-0004ap-Rp for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2013 09:57:11 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UrTk2-0004al-Nn for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2013 09:57:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1UrTk1-0003fl-8j for bug-gnu-emacs@gnu.org; Tue, 25 Jun 2013 09:57:05 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stephen Berman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 25 Jun 2013 13:57:05 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14702 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 14702-submit@debbugs.gnu.org id=B14702.137216858714058 (code B ref 14702); Tue, 25 Jun 2013 13:57:05 +0000 Original-Received: (at 14702) by debbugs.gnu.org; 25 Jun 2013 13:56:27 +0000 Original-Received: from localhost ([127.0.0.1]:40453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrTjN-0003eg-VE for submit@debbugs.gnu.org; Tue, 25 Jun 2013 09:56:26 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:52284) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1UrTjK-0003eC-2E for 14702@debbugs.gnu.org; Tue, 25 Jun 2013 09:56:23 -0400 Original-Received: from mailout-de.gmx.net ([10.1.76.35]) by mrigmx.server.lan (mrigmx001) with ESMTP (Nemesis) id 0Le7py-1UUEqZ3Hy8-00pxah for <14702@debbugs.gnu.org>; Tue, 25 Jun 2013 15:56:15 +0200 Original-Received: (qmail invoked by alias); 25 Jun 2013 13:56:15 -0000 Original-Received: from i59F575FA.versanet.de (EHLO rosalinde.fritz.box) [89.245.117.250] by mail.gmx.net (mp035) with SMTP; 25 Jun 2013 15:56:15 +0200 X-Authenticated: #20778731 X-Provags-ID: V01U2FsdGVkX18vTIwUqpov6E9kQKhZX5xtQgKfJ+ljHpLxmGGS/C rJtrbQcBYafi/1 In-Reply-To: (Stefan Monnier's message of "Mon, 24 Jun 2013 21:39:21 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Y-GMX-Trusted: 0 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:75557 Archived-At: On Mon, 24 Jun 2013 21:39:21 -0400 Stefan Monnier wrote: >> (defun baz () >> (interactive) >> (catch 'test >> (if (called-interactively-p 'any) > > If it hurts, don't do that. > Internally, the byte-compiled form of catch ends up wrapping its body > inside a lambda, Ah, knowing that I now understand what the disassembled code shows, which I didn't before, even though there's a hint to that effect in the Emacs Lisp manual (i.e., "If it is a lambda expression, `disassemble' compiles it and disassembles the resulting compiled code."). > so the called-interactively-p test refers to the > implicit lambda added, rather than to the enclosing function > you defined. > > It would be good to avoid this intermediate lambda for performance > reasons (which would incidentally also fix this particular issue), but > in the mean time (and more generally) either avoid > called-interactively-p (pass an extra argument instead), or avoid > placing it "deep" within your function (e.g. inside > a catch/unwind-protect/condition-case/save-foobar/...). At the moment I don't see a way to do either of these: I can't use an extra argument, because the command where I use called-interactively-p already uses a prefix argument for another purpose; and I don't see an alternative to something like `catch', because I need to stop execution of the command in the middle, when certain conditions obtain (this is my current fix for the recently reported Todo mode bug -- though I'm trying to come up with something better, so maybe `catch' will then be dispensable). But maybe I can use (eq this-command ') instead of called-interactively-p, since evidently this-command is not effected by the intervening lambda. Or can that sexp ever return t when is not called interactively? Steve Berman