[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: address@hidden: RE:weirddefadvicebugwithbyte-compilation]
From: |
Drew Adams |
Subject: |
RE: address@hidden: RE:weirddefadvicebugwithbyte-compilation] |
Date: |
Mon, 12 Dec 2005 20:59:58 -0800 |
> Where is the bug? The byte-compiler warning presumably arose
> because it compiled a defadvice that referred to variable my-mode.
> That variable is not bound in the defadvice body and it might
> not be bound at the point in the
> file when the defadvice is compiled. Is that a bug?
(I thought you actually said elsewhere in this
thread that it was a bug, and that you deliberately kept it in the
code to reproduce the crash.)
No. At one point I mistakenly thought that the byte-compilation was evaling
the variable. I was surprised that the quoted unbound variable was evaled
(it was the frame creation that tried to check a menu-enable property and
evaled the variable).
Also, I expected define-minor-mode to somehow DTRT, defining the mode
variable first thing when the file was loaded, but I guess it doesn't do
that. Users are, I believe, told to turn on a minor mode by using the mode
toggle function, not by setting the mode variable. But if you do that in a
case like this (as I did, in my .emacs), you can get an unbound-variable
error like this. I suspect it is common to use a minor-mode var in a
menu-bar menu-enable property, though it is probably uncommon to do so for
an existing menu-bar menu (e.g. Search), rather than a menu specific to the
mode.
> Should people systematically place defadvice last in a file or do
> (provide 'x)(require 'x) just to make sure that all variables in a
> defadvice body are defined before it is compiled?
If you want the byte compiler help you find such typos, then yes, you
should try to eliminate gratuitous warnings, to keep the noise level
low enough for you to see the real warnings.
> I also don't understand, as I mentioned, _why_ the defadvice
> in foo.el is byte-compiled - it has no `compile' keyword.
I thought this was how defadvice worked, but I might be wrong. In any
case, the fact that the byte compiler is run is clear from the
backtrace.
That it would be run for bar.el, whose defadvice has the keyword `compile',
I understand. That it would be run for foo.el, whose defadvice has no
`compile', I do not understand. Is that how defadvice works? Can someone
clear this up?
- Re: address@hidden:RE:weirddefadvicebugwithbyte-compilation], (continued)
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Eli Zaretskii, 2005/12/11
- RE: address@hidden: RE: weird defadvice bug withbyte-compilation], Drew Adams, 2005/12/11
- Re: address@hidden: RE: weird defadvice bug withbyte-compilation], Eli Zaretskii, 2005/12/12
- RE: address@hidden: RE: weird defadvice bugwithbyte-compilation], Drew Adams, 2005/12/12
- RE: address@hidden: RE: weird defadvicebugwithbyte-compilation], Drew Adams, 2005/12/12
- Re: address@hidden: RE: weird defadvicebugwithbyte-compilation], Eli Zaretskii, 2005/12/12
- RE: address@hidden: RE: weirddefadvicebugwithbyte-compilation], Drew Adams, 2005/12/12
- Re: address@hidden: RE: weirddefadvicebugwithbyte-compilation], Eli Zaretskii, 2005/12/12
- RE: address@hidden: RE:weirddefadvicebugwithbyte-compilation],
Drew Adams <=
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Richard M. Stallman, 2005/12/12
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Eli Zaretskii, 2005/12/12
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Richard M. Stallman, 2005/12/12
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Eli Zaretskii, 2005/12/12
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Richard M. Stallman, 2005/12/13
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Eli Zaretskii, 2005/12/14
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Richard M. Stallman, 2005/12/14
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Eli Zaretskii, 2005/12/14
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Richard M. Stallman, 2005/12/15
- Re: address@hidden: RE: weird defadvice bug with byte-compilation], Eli Zaretskii, 2005/12/16