From: era@iki.fi
Subject: Re: Bug in emacs
Date: 14 Oct 2003 09:05:20 +0300 [thread overview]
Message-ID: <87vfqsl64g.fsf@era.iki.fi> (raw)
In-Reply-To: 3F8AD296.7010803@yahoo.com
On Mon, 13 Oct 2003 10:28:06 -0600, Kevin Rodgers <ihs_4664@yahoo.com>
posted to gmane.emacs.bugs:
> era@iki.fi wrote:
>> I'm not sure what the bug really is. Perhaps it would be useful to
>> get a warning when compiling / evaling something when a macro +is+
>> in effect and the file you are compiling is not pulling it in
>> properly? Then at least you get a hint to fix it while you still
>> can, while those who do it right will not experience any adverse
>> effects.
> When the compiler comes across a (function arg ...) form, either the
> function is defined or it isn't. If it's defined, either as a function
> or a macro, all is well. If it's not defined, the compiler can't know
> whether it is a function or a macro and assumes it's a function. A
> macro can't be "in effect" if it's file was not loaded "properly".
What I'm saying is that macro expansion during compilation could
trigger a warning if the macro is not loaded properly by the code
which is being compiled. This is a fuzzy idea at best, but I was
thinking of something like:
0. Maintain a buffer of per-byte-compilation macros
1. When a new byte compilation starts, flush the buffer of macros.
Set a flag to indicate that byte compilation is in progress. (I
would kind of assume that this already happens but I haven't
checked.)
2. When byte compilation is taking place and a macro is defined, add
the macro to the buffer of per-byte-compilation macros with the
property "defined during compilation".
3. When byte compilation is taking place and a macro is expanded,
check in the buffer, and if the macro is not listed as having
been defined during this compilation, throw a warning.
4. When byte compilation finishes, the flag to indicate that byte
compilation is taking place will need to be taken down, of
course.
This obviously requires already-loaded requires etc to be performed
anew during byte compilation, or some cunning caching of the buffer
which keeps track of when and where a macro was defined (maybe make it
global and permanent per session instead of per-compilation?)
> The compiler does issue warnings when it encounters an undefined
> macro/function:
> While compiling the end of the data in file /home/kevinr/emacs/foo.el:
> ** the function bar is not known to be defined.
So now you'd also get something like
While compiling toplevel forms:
** reference to macro `foo' which was not defined during compilation
as a warning that the code may not execute correctly on a system where
the macro is not somehow automatically loaded before the compiled code
will be executed. (As a bonus maybe the `foo' could be clickable so
you could look at the macro's documentation and maybe find out where
it is defined.)
/* era */
--
The email address era the contact information Just for kicks, imagine
at iki dot fi is heavily link on my home page at what it's like to get
spam filtered. If you <http://www.iki.fi/era/> 500 pieces of spam for
want to reach me, see instead. each wanted message.
next prev parent reply other threads:[~2003-10-14 6:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-07 13:44 Bug in emacs Jean Pierre Lemue
2003-10-13 12:39 ` era
[not found] ` <mailman.1587.1066050220.21628.bug-gnu-emacs@gnu.org>
2003-10-13 16:28 ` Kevin Rodgers
2003-10-14 6:05 ` era [this message]
2003-10-16 7:59 ` era
2003-10-17 8:52 ` era
-- strict thread matches above, loose matches on Subject: below --
2005-10-05 0:25 Eric J Russell
2005-10-05 22:45 ` Richard M. Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87vfqsl64g.fsf@era.iki.fi \
--to=era@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).