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: Bruce Stephens
Subject: Re: called-interactively-p, cedet, and Emacs 23.1 and earlier
Date: Tue, 27 Apr 2010 12:22:52 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>> I don't know.  Compatibility, maybe?  Or maybe just uniformity, since
>> the same file also has defadvice for narrow-to-defun, mark-defun,
>> c-mark-function, add-log-current-defun, insert-register,
>> jump-to-register, not all of which have hooks, I guess.
>
> beginning/end-of-defun-function should cover narrow-to-defun and
> mark-defun.  add-log-current-defun has a similar hook variable.
> For the rest I don't know what would be needed.  But in any case, any
> defadvice should be justified by a "request for feature".

Sure, and in the version bundled with Emacs I imagine there's less of a
problem: it can just use called-interactively-p and (if required) add
and use the relevant hooks, presuming that's acceptable to other
developers.

However, that kind of option didn't (and doesn't) really apply to code
intended to run on a variety of versions.  Concretely, it doesn't work
for Emacs 23.1, and using defadvice seems reasonable.

But it doesn't seem to work properly: "cedet-called-interactively-p is a
Lisp macro.", but I get errors: "beginning-of-defun: Invalid function:
cedet-called-interactively-p".

So, is it the case that it's unsafe using macros in the body of advice,
or is this indicating that the macro wasn't defined when defadvice was
called, or activated?  If one or other of the latter, how could I tell?
For a normal function I could use disassemble (to make sure macros had
been expanded), but I'm not sure what object I'd look at with advice.




reply via email to

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