emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: called-interactively-p


From: Andreas Roehler
Subject: Re: called-interactively-p
Date: Fri, 06 Nov 2009 12:09:13 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20081227)

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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]