From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Roehler Newsgroups: gmane.emacs.devel Subject: Re: called-interactively-p Date: Fri, 06 Nov 2009 12:09:13 +0100 Message-ID: <4AF403D9.7010800@online.de> References: <71E22738-DB4D-4A16-8821-D371B6E991A1@gmail.com> <8C5A8BDE-77E6-4BE5-90F3-636F4042093C@uva.nl> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1257502189 13981 80.91.229.12 (6 Nov 2009 10:09:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Nov 2009 10:09:49 +0000 (UTC) Cc: Juanma Barranquero , dominik@uva.nl, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 06 11:09:41 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1N6LlF-0005px-2s for ged-emacs-devel@m.gmane.org; Fri, 06 Nov 2009 11:09:41 +0100 Original-Received: from localhost ([127.0.0.1]:43250 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N6LlE-0003Au-Ih for ged-emacs-devel@m.gmane.org; Fri, 06 Nov 2009 05:09:40 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N6Ll0-000327-Ln for emacs-devel@gnu.org; Fri, 06 Nov 2009 05:09:26 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N6Lkv-0002wq-5n for emacs-devel@gnu.org; Fri, 06 Nov 2009 05:09:25 -0500 Original-Received: from [199.232.76.173] (port=46807 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N6Lku-0002wX-Nq for emacs-devel@gnu.org; Fri, 06 Nov 2009 05:09:20 -0500 Original-Received: from moutng.kundenserver.de ([212.227.17.10]:60226) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N6Lku-0004Nt-1S for emacs-devel@gnu.org; Fri, 06 Nov 2009 05:09:20 -0500 Original-Received: from [192.168.178.27] (p54BEA759.dip0.t-ipconnect.de [84.190.167.89]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LtUF2-1M7bll483g-011Qch; Fri, 06 Nov 2009 11:09:14 +0100 User-Agent: Thunderbird 2.0.0.19 (X11/20081227) In-Reply-To: X-Provags-ID: V01U2FsdGVkX19AN+vquFyVnz2P4dWLb5mNLPzjTm1C1U7pYwm Kcum3XcFFTfFbnQtnAG6aPBtjJsKkr9/e2gIaaMJk7Jf0dXu6+ XIBGu36O3DizzMrMMbj78ilNaDPL2sX9y6EpPYZls8= X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:116679 Archived-At: Stefan Monnier wrote: >> Well, it turns out that I don't know a good way to take care of this. >> I would like to have Org be compatible with Emacs 22 and also XEmacs, >> and I don't know how I can do this with the new `called-interactively', >> except for creating diverging code bases. > > Yes, this is a problem. The best I can offer is to use a macro that > expands to either of the alternatives (a function wouldn't work because > it would cause interactive-p to always return nil). > > (defmacro org-called-interactively-p (kind) > (condition-case nil > (progn (called-interactively-p nil) > ;; If the call didn't signal an error, then the new form > ;; is supported: use it. > `(called-interactively-p ,kind)) > (wrong-number-of-arguments > ;; Probably Emacs-23.1. > (if (equal (eval kind) 'interactive) > `(interactive-p) > `(called-interactively-p))) > (error > ;; called-interactively-p seems not to be supported, fallback > ;; on the good ol' interactive-p. > `(interactive-p)))) > > Of course the above code is guaranteed 100% untested. > > > Stefan > > > Remember thread "interactive-p and called-interactively-p". Think Drew Adams was right and your first response too. Otherwise we see things going still more complicated. Cheers Andreas