From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: called-interactively-p Date: Thu, 05 Nov 2009 14:13:12 -0500 Message-ID: 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=us-ascii X-Trace: ger.gmane.org 1257448432 1207 80.91.229.12 (5 Nov 2009 19:13:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Nov 2009 19:13:52 +0000 (UTC) Cc: Juanma Barranquero , emacs-devel@gnu.org, Carsten Dominik To: Carsten Dominik Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 05 20:13:44 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 1N67mB-0007qY-An for ged-emacs-devel@m.gmane.org; Thu, 05 Nov 2009 20:13:44 +0100 Original-Received: from localhost ([127.0.0.1]:39292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N67mA-0002sx-MW for ged-emacs-devel@m.gmane.org; Thu, 05 Nov 2009 14:13:42 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N67ln-0002Wj-6M for emacs-devel@gnu.org; Thu, 05 Nov 2009 14:13:19 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N67li-0002PE-9v for emacs-devel@gnu.org; Thu, 05 Nov 2009 14:13:18 -0500 Original-Received: from [199.232.76.173] (port=42453 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N67li-0002P3-6c for emacs-devel@gnu.org; Thu, 05 Nov 2009 14:13:14 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.183]:18788 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N67li-0003pN-0N for emacs-devel@gnu.org; Thu, 05 Nov 2009 14:13:14 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsEAMuy8kpFpZ9t/2dsb2JhbACBTt8ThD0EiQE X-IronPort-AV: E=Sophos;i="4.44,687,1249272000"; d="scan'208";a="48763202" Original-Received: from 69-165-159-109.dsl.teksavvy.com (HELO ceviche.home) ([69.165.159.109]) by ironport2-out.pppoe.ca with ESMTP; 05 Nov 2009 14:13:12 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 65B15B40E4; Thu, 5 Nov 2009 14:13:12 -0500 (EST) In-Reply-To: <8C5A8BDE-77E6-4BE5-90F3-636F4042093C@uva.nl> (Carsten Dominik's message of "Thu, 5 Nov 2009 16:22:41 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) 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:116666 Archived-At: > 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