emacs-devel
[Top][All Lists]
Advanced

[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 13:53:31 -0800

    > This makes me wonder now if byte-compiling in defadvice (i.e.
    > on the fly)
    > should display a *Compile Log* buffer at all. I don't know.

    Why not?  It's a byte compilation like any other one, and these
    warnings do serve a purpose: your code, as posted, had a bug.

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? It is only a warning, so
I don't really mind, but I don't see how the code is bugged. 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?

    > In any case, that's clearly the cause of the problem here (but not
    > the explanation of the crash bug).

    The explanation of the crash is that, because the *Backtrace* buffer
    is displayed in its own separate frame, and that separate frame is
    created in the middle of the process of creating the *Compile-Log*'s
    frame's menu, Emacs somehow fails to record the *Backtrace* frame in
    the list of live frames.  And then, when Emacs is killed, the function
    check_glyph_memory, which walks the frame list and releases all the
    glyph matrices it finds in each frame, misses that one frame which is
    not recorded in the list of frames.

Thanks.

    Can someone please try reproducing this in a non-toolkit X build?  I
    think that build might have the same problem as the MS-Windows build.

    > I still have a question, however, about how best to use
    > define-minor-mode to define the mode variable so that it can be
    > used in a put 'menu-enable. Is it necessary to do the
    > define-minor-mode before doing the put? I guess so; but
    > in that case, I prefer the old method of defining a
    > minor-mode function and its variable (defcustom) separately.
    > The problem is the same, but I always place variable definitions
    > at the top, and such a defcustom would be defined before the
    > variable was used in the put 'menu-enable. In the new system, I
    > was calling the minor-mode function first thing (in .emacs),
    > to set the variable, but that function couldn't be called until
    > its defining library was loaded, and that meant that the
    > variable wasn't defined when the *Compile Log* was displayed
    > when byte-compiling a defadvice in the file.

    Sorry, I'm not an expert on minor modes.  Anyone?

I also don't understand, as I mentioned, _why_ the defadvice in foo.el is
byte-compiled - it has no `compile' keyword. Only the defadvice in bar.el
has `compile', and it does not refer to variable my-mode. If the defadvice
in bar.el is removed, the bug is not manifested, presumably because the
defadvice in foo.el is not byte-compiled. I don't see why a `compile' in a
defadvice in one file would cause compilation of a defadvice in another
file. Is that normal?






reply via email to

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