unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Carsten Dominik <dominik@uva.nl>
Cc: Juanma Barranquero <lekktu@gmail.com>,
	emacs-devel@gnu.org, Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: called-interactively-p
Date: Thu, 05 Nov 2009 14:13:12 -0500	[thread overview]
Message-ID: <jwvr5sclrli.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <8C5A8BDE-77E6-4BE5-90F3-636F4042093C@uva.nl> (Carsten Dominik's message of "Thu, 5 Nov 2009 16:22:41 +0100")

> 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




  reply	other threads:[~2009-11-05 19:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-01 18:15 called-interactively-p Stefan Monnier
2009-10-02  3:59 ` called-interactively-p Juanma Barranquero
2009-10-09  8:50   ` called-interactively-p Carsten Dominik
2009-11-05 15:22     ` called-interactively-p Carsten Dominik
2009-11-05 19:13       ` Stefan Monnier [this message]
2009-11-06 11:09         ` called-interactively-p Andreas Roehler
2009-11-09 16:28         ` called-interactively-p Carsten Dominik
2009-11-09 22:00           ` called-interactively-p Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvr5sclrli.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=carsten.dominik@gmail.com \
    --cc=dominik@uva.nl \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).