From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?= Newsgroups: gmane.emacs.devel Subject: Re: Suggest: dont declare interactive-p obsolete Date: Thu, 19 Nov 2015 14:06:21 +0100 Message-ID: <564DC94D.8010002@online.de> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1447938354 21096 80.91.229.3 (19 Nov 2015 13:05:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Nov 2015 13:05:54 +0000 (UTC) Cc: John Wiegley , bruce.connor.am@gmail.com, raman To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 19 14:05:46 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 1ZzOuF-0007aU-DJ for ged-emacs-devel@m.gmane.org; Thu, 19 Nov 2015 14:05:43 +0100 Original-Received: from localhost ([::1]:41527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzOuE-00041X-Uo for ged-emacs-devel@m.gmane.org; Thu, 19 Nov 2015 08:05:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzOu3-000416-Mh for emacs-devel@gnu.org; Thu, 19 Nov 2015 08:05:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzOty-0004fJ-CR for emacs-devel@gnu.org; Thu, 19 Nov 2015 08:05:31 -0500 Original-Received: from mout.kundenserver.de ([212.227.126.133]:55868) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzOty-0004eU-23 for emacs-devel@gnu.org; Thu, 19 Nov 2015 08:05:26 -0500 Original-Received: from [192.168.178.31] ([95.119.226.40]) by mrelayeu.kundenserver.de (mreue002) with ESMTPSA (Nemesis) id 0M9S4k-1a5TzD09fS-00CgmI; Thu, 19 Nov 2015 14:05:21 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 In-Reply-To: X-Provags-ID: V03:K0:xze/bSN+FWThvb3OBbzK3jtgAV/4xnVPdSsfX/CkiPlHF7Mbgf4 WktTL5v6DKgCUVwXFb+tYiWnd4ydgpOYUn9xkgd8WiylBti5/z2iME59gtIWSJwCUzOAsLm KneAEBplkiwMz2t9SBRtgBEjVTwQQmNipqb2yEs576EdPJ6VSLSiDaH/69Ij7Rik539WoZR ynU7lWp6arwFc/z3tFZmg== X-UI-Out-Filterresults: notjunk:1;V01:K0:7oqWbGOJP4g=:itz3QIX3Xi6X0IcvITnJNz Ubd8xwCP93lpKmJ3xiyjrwY8ZOiyw5AS7t6czTqK9Bbm+7WguAnl+YbCB/DLW1+AGtIUzs2l5 8AgID+OOtScj9NdrLhcRenslGwclNirFHgkbLHn1bF+eLExIvE9SpQ/M3XIpo8FRporWACh7r /wkBFzwguIbEVSZOKnVf3uDDp5WxwrLnRItD2pXSm6nswVSFgi33ATYY9CKm5Qr4dhgpTeE91 nzWU69A2L2s8C2l2sWKRHdse+mfB/lrH9QY/dQAggE4uedQyuLnXg7VMg2qAm94USa2Ag15fj n8RhEB9p4wZjd+Tr008+0be8xHo73jtVtxugMS7bsikgSSfq6ZAV1b1DUt/Zn81gol7thAYkK AsXoPFyNoCmvpn80XfmPRORWtBw3HgMZGfJBrdDLsB+oG5oVL85abpG2pr4Gl3fJLJa/Oc2Ww NJu19zAoGA91DFAz9bghr92erkediRtvndb4gbCrJeAtnmazj05WjXLmfbF7C7t2kOTw8SwT7 vXQ3uAQqQvGoPezsy0HpevgZe7Bq83Z5HWPU3Pdr0BY6Fm0lNzX3KtzpV/8qgYibiV6KZS/Oo dPlfn4vjOa6B4bBkej9xlmldX5CcxUvGD1+qtyhLP0pnwhcYFwEfyvGvY6nthLcM3d3L+j++p y42H39CG5ABMi+oSFmGnR1hXwKHS4BRy2VQx92ojTkOXgXn6pFywYYgq6R+y5N7ga2sAV2C7v Rc+D2PpqZ5ViMdEs X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.133 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:194783 Archived-At: On 19.11.2015 09:39, Artur Malabarba wrote: > 2015-11-19 4:16 GMT+00:00 John Wiegley: >>>>>>> raman writes: >>> This is a minor change -- that will let existing code run without warnings. >>> If we turned the defun in subr.el to a defsubst and dropped the (declare >>> (obsolete called-interactively-p "23.2")) (called-interactively-p >>> 'interactive)) >> I don't see any downsides to this; others? > I wasn't here when this function was made obsolete, but I can think of > a couple of downsides: > > 1. Code duplication (sure, the code is already duplicated, but by > keeping it obsolete we can hopefully remove it soon). > 2. The name interactive-p makes it sound like it's equivalent to `(not > noninteractive)', which determines whether Emacs itself (not the > function) is running interactively. While `called-interactively-p' is > more obviously about how the function was called. > > By my estimates, this function was made obsolete 5 years ago. And it > _is_ obsolete. Don't think so. Its replacement is not only hard to code, it's a monster. The docu says all: Return t if the containing function was called by `call-interactively'. If KIND is `interactive', then only return t if the call was made interactively by the user, i.e. not in `noninteractive' mode nor when `executing-kbd-macro'. If KIND is `any', on the other hand, it will return t for any kind of interactive call, including being called as the binding of a key or from a keyboard macro, even in `noninteractive' mode. This function is very brittle, it may fail to return the intended result when the code is debugged, advised, or instrumented in some form. Some macros and special forms (such as `condition-case') may also sometimes wrap their bodies in a `lambda', so any call to `called-interactively-p' from those bodies will indicate whether that lambda (rather than the surrounding function) was called interactively. Instead of using this function, it is cleaner and more reliable to give your function an extra optional argument whose `interactive' spec specifies non-nil unconditionally (\"p\" is a good way to do this), or via \(not (or executing-kbd-macro noninteractive)). The only known proper use of `interactive' for KIND is in deciding whether to display a helpful message, or how to display it. If you're thinking of using it for any other purpose, it is quite likely that you're making a mistake. Think: what do you want to do when the command is called from a keyboard macro? > IMHO, packages that try to support Emacs releases 6 years apart (as > noble as that is) can't expect to be able to do that without a few > warnings. There are ways for such packages to suppress these warnings. > But it's important to keep them to prevent this function from > spreading. >