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: Sat, 27 Mar 2010 10:11:24 -0400
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.3a1pre) Gecko/20091222 Shredder/3.1a1pre

Ok, now I'm stumped again.

While the code snippet I quoted below "works", as in it allows the new code to run in old Emacsen, it does not work in that it always returns false, since there is one level of function redirection, thus that function (cedet-called-interactively-p) is never called interactively.

Anyway, that makes it obvious why Stefan used a macro before.

Does anyone know of a way to solve this, or do I need to maintain this difference in my code?

Thanks
Eric


On 03/26/2010 12:06 PM, Eric M. Ludlam wrote:
On 03/26/2010 11:33 AM, Davis Herring wrote:
an in Emacs 23.1, it now emits this:

Invalid function: called-interactively-p

Perhaps you have compiled code calling called-interactively-p, and then
are redefining it as a macro? That won't work. If you're going to have
to make it a macro, you'll have to also then recompile any code that
calls
it.

Ah, That won't be possible since Emacs 23 has lots of code that is
compiled using this already.

I saved off the old symbol function for called-interactively-p and used
it in a new version of the function. This appears to now work.

I've checked this into my CEDET CVS repository, so now Lluis should be
able to safely finish merging Emacs changes into CEDET, and things will
keep working in Emacs 23.1 and eaerlier, and in XEmacs.

Thanks
Eric

------------
(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
;; This condition case also prevents this from running twice.
(called-interactively-p nil)
(error
(defvar cedet-compat-called-interactively-p
(let ((tmp (symbol-function 'called-interactively-p)))
(if (subrp tmp)
tmp
;; Did someone else already override it?
(or cedet-compat-clled-interactively-p tmp)))
"Built-in called interactively function.")
;; Create a new one
(defun cedet-called-interactively-p (&optional arg)
"Revised from the built-in version to accept an optional arg."
(case arg
(interactive (interactive-p))
((any nil) (funcall cedet-compat-called-interactively-p))))
;; Override
(fset 'called-interactively-p 'cedet-called-interactively-p)
)))







reply via email to

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