[Top][All Lists]

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

RE: address@hidden: RE: weird defadvice bug withbyte-compilation]

From: Drew Adams
Subject: RE: address@hidden: RE: weird defadvice bug withbyte-compilation]
Date: Sun, 11 Dec 2005 13:35:46 -0800

    Does this make sense?

It does, as far as I can tell. I don't understand all of it, however, I
admit. I still don't understand, for instance:

1. why byte-compiling the defadvice in bar.el would eval my-mode (my-mode
does not even appear in bar.el)

2. why evaling the defadvice in foo.el would eval my-mode (the BODY of
defadvice is not supposed to be quoted)

3. what the interaction is between the two defadvice's in the two files, and
how they relate to byte-compiling

4. how to use define-minor-mode in connection with the menu-enable keymap

5. why selecting (require 'foo) and doing eval-region does not manifest the
bug, but putting the cursor after (require 'foo) and doing `C-x C-e' does
manifest the bug.

Wrt #3, only the defadvice in bar.el has `compile', and that defadvice evals
without error. It is when you eval the (require 'foo) that the unbound error
occurs. Also, neither advised function is actually called.

Wrt #4, the original context uses define-minor-mode to define variable
my-mode. I also forgot to mention that I turn on the minor mode in my .emacs
(by calling the my-mode function), before loading the libraries in question,
and the library that corresponds to foo.el does this at the end:

 ;; Apparently, this is needed if the initial value is non-nil.
 ;; Otherwise, the lighter shows the mode as on, but it is not on.
 (if my-mode (my-mode 1))


BTW (doc bug?) -

The doc string for defadvice does not really explain what BODY is for - it
says only this: "Any s-expression". Neither the doc string nor the Info
explanation of BODY-FORMS explains that it should not be quoted (it is not
evaled by defadvice). I would expect both doc string and Info to make
reference to the body forms when describing the overall effect and perhaps
also when describing the other individual args.

reply via email to

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