emacs-devel
[Top][All Lists]
Advanced

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

Re: called-interactively-p, cedet, and Emacs 23.1 and earlier


From: Eric M. Ludlam
Subject: Re: called-interactively-p, cedet, and Emacs 23.1 and earlier
Date: Thu, 25 Mar 2010 19:16:16 -0400
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.3a1pre) Gecko/20091222 Shredder/3.1a1pre

On 03/24/2010 01:51 PM, Stefan Monnier wrote:
We have recently stumbled over called-interactively-p, which is now used
with an argument throughout the Emacs versions of the CEDET code.
My externally maintained code I would like to have work in Emacs 22 and 23.1
which does not support the argument, and XEmacs which is missing the feature
completely, and is thus easy to make work in this case. Could some kind soul
help me define some advice, or other trick I can install in older Emacs to
allow this form to work?

How 'bout

(condition-case nil
     (called-interactively-p nil)
   (defmacro called-interactively-p (arg)
     (case arg
       (interactive `(interactive-p))
       ((any nil) `(called-interactively-p)))))

Hi Stefan

I've adapted the above into this:

(if (not (fboundp 'called-interactively-p))
    (defsubst called-interactively-p (&optional arg)
      "Compat function.  Calls `interactive-p'"
      (interactive-p))
  ;; Else, it is defined, but perhaps too old?
  (condition-case nil
      (called-interactively-p nil)
    (error
     (defmacro called-interactively-p (&optional arg)
       "Macro to support optional input arg for built-in."
       (case arg
         (interactive `(interactive-p))
         ((any nil) `(called-interactively-p))))
     )))

an in Emacs 23.1, it now emits this:

Invalid function: called-interactively-p

and I have to kill from the command prompt, because it is used so much.

I had similar issues trying to figure out how advice in this case would work before I emailed the first time.

Any other thoughts?
Thanks
Eric




reply via email to

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