From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Carsten Dominik Newsgroups: gmane.emacs.devel Subject: Re: called-interactively-p Date: Mon, 9 Nov 2009 17:28:57 +0100 Message-ID: <0758A105-5B09-413A-8F5A-9C46386669BD@uva.nl> 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 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1257825416 30757 80.91.229.12 (10 Nov 2009 03:56:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 10 Nov 2009 03:56:56 +0000 (UTC) Cc: Juanma Barranquero , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 10 04:56:49 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 1N7hqa-00028u-FE for ged-emacs-devel@m.gmane.org; Tue, 10 Nov 2009 04:56:48 +0100 Original-Received: from localhost ([127.0.0.1]:45051 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7hqa-00085t-1Y for ged-emacs-devel@m.gmane.org; Mon, 09 Nov 2009 22:56:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N7bNM-0008KZ-5g for emacs-devel@gnu.org; Mon, 09 Nov 2009 16:02:12 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N7bNH-0008Fq-CJ for emacs-devel@gnu.org; Mon, 09 Nov 2009 16:02:11 -0500 Original-Received: from [199.232.76.173] (port=52527 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N7bNH-0008FT-38 for emacs-devel@gnu.org; Mon, 09 Nov 2009 16:02:07 -0500 Original-Received: from postduif.ic.uva.nl ([145.18.40.180]:32958) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N7bNG-0004tn-C7 for emacs-devel@gnu.org; Mon, 09 Nov 2009 16:02:06 -0500 Original-Received: from [192.168.1.10] (dc5146846e.adsl.wanadoo.nl [81.70.132.110]) (authenticated bits=0) by postduif.ic.uva.nl (8.13.1/8.13.1) with ESMTP id nA9L1wRg006595 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 9 Nov 2009 22:01:59 +0100 In-Reply-To: X-Mailer: Apple Mail (2.936) X-Spam-Score: undef - spam scanning disabled X-CanIt-Geo: ip=81.70.132.110; country=NL; region=16; city=Zeewolde; latitude=52.3667; longitude=5.5500; http://maps.google.com/maps?q=52.3667,5.5500&z=6 X-CanItPRO-Stream: auth (inherits from default) X-Canit-Stats-ID: Bayes signature not available X-Scanned-By: CanIt (www . roaringpenguin . com) on 145.18.40.180 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Mon, 09 Nov 2009 22:56:43 -0500 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:116786 Archived-At: On Nov 5, 2009, at 8:13 PM, 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). And a macro will only work if the user runs compiled code, right? - Carsten > > (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 - Carsten