help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: file/line info for macro expansion


From: Stefan Monnier
Subject: Re: file/line info for macro expansion
Date: Wed, 05 Jan 2011 01:10:02 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> I think it is not possible, but I'm ready to be surprised.
> Basically, I'd like macros of the form:

>   (declare-foo args)

> to expand to something containing the file and line number of the
> expansion site.

You mostly can't right now, sorry.

It would be feasible for byte-compiled code (and indeed, you can
somewhat do it by outputting #$ in the .elc file which will be replaced
by the file name), but for interpreted code it's a lot more tricky,
because the macro is only expanded when it is run, which can be months
after the file has been read.  And before the macro is expanded, Emacs
has no idea it's a macro call rather than a function call, so it can't
realistically remember the file&line info for that call until it
gets expanded.


        Stefan



reply via email to

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