From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitri Paduchikh Newsgroups: gmane.emacs.devel Subject: Re: Brittleness of called-interactively-p Date: Mon, 13 Jul 2015 20:17:50 +0500 Message-ID: <87380st7c1.fsf@gmail.com> References: <871tgeufzt.fsf@gmail.com> <87r3odtngi.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1436800685 23146 80.91.229.3 (13 Jul 2015 15:18:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Jul 2015 15:18:05 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jul 13 17:18:05 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZEfUa-0007IP-RF for ged-emacs-devel@m.gmane.org; Mon, 13 Jul 2015 17:18:04 +0200 Original-Received: from localhost ([::1]:55314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEfUa-0001DY-43 for ged-emacs-devel@m.gmane.org; Mon, 13 Jul 2015 11:18:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEfUV-0001A3-E0 for emacs-devel@gnu.org; Mon, 13 Jul 2015 11:18:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZEfUO-000301-S1 for emacs-devel@gnu.org; Mon, 13 Jul 2015 11:17:59 -0400 Original-Received: from mail-lb0-x232.google.com ([2a00:1450:4010:c04::232]:34011) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZEfUO-0002zg-K2 for emacs-devel@gnu.org; Mon, 13 Jul 2015 11:17:52 -0400 Original-Received: by lbbzr7 with SMTP id zr7so3943711lbb.1 for ; Mon, 13 Jul 2015 08:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=XyTSH8Wn9jiuCRTpuSebx+0DZEPovgckMWYEw29ntuc=; b=qMXw6+v5QN60Wf5oTJ0enGtqiGmkLPIrKFdoh9MaOJ5Qc1qe/AStTUeNxp0aBSua5+ QFrEDcmTqqEv0yVdeF0Gkngv5RZTUhQ+WyZ4IlIGrCxWMI4dMGy90X9EkC4bRCl79G6s vZvyz4vUeBoGuogAE/UI7tr9uo8wc4ApIAVti43bYu94W666848M7aWJN5l964ub8T87 YW6DlfAfH5fJ+LyADd+3tAi4GJEFMMNmxLTi1UPRCS+mDDAB3zlcZK1OQoV3jcHG4GOM 1RiSAkTJiJw2dfBqDub3KJRVKAFh5Ppme1Deb+G/6YcSwZ6i6aKEfxG2PaHitODAwVv/ ZeAw== X-Received: by 10.152.3.70 with SMTP id a6mr32809928laa.44.1436800671943; Mon, 13 Jul 2015 08:17:51 -0700 (PDT) Original-Received: from gmail.com ([46.48.49.226]) by smtp.gmail.com with ESMTPSA id w6sm4906463lbs.37.2015.07.13.08.17.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jul 2015 08:17:51 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sun, 12 Jul 2015 19:26:36 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:187854 Archived-At: Stefan Monnier writes: SM> You might be able to exploit this "ignore non-interactive functions" to SM> make the current code more robust, indeed. It might be reasonably easy, SM> e.g. replace SM> (memq (nth 1 frame) '(interactive-p 'byte-code)) SM> with something like (not (commandp (nth 1 frame)). But note that the SM> situation for advised functions is still tricky: the outer advice is called SM> with funcall-interactively (and it interactive) but inner advices and the SM> original function are always called with `apply' or `funcall' rather SM> than with funcall-interactively, so called-interactively-p still has to SM> work harder to try and figure out that "the inner function is actually, SM> conceptually, called interactively, even though technically it's not". These calls are internal to the advice mechanism and, of course, they cannot be considered conceptually interactive. Only the call to the whole advised function matters if that function is interactive. Other advice-specific calls should be ignored as well as calls to non-interactive functions. They can be filtered out, for example, by labelling advice-specific symbols by special property during advice creation and then checking for this property inside called-interactively-p. Such symbols as ad-Advice-* are intended to be used internally by advice only, so ignoring them inside called-interactively-p should not cause much harm.