I'm going to try to fix func-menu by fixing the byte-compiler.
I just wanted to give some background about how the old way was also
broken, and what I was trying to fix with my original patch.
Here is the promise made by the lispref:
----------------------------------------------------------------
In order for compilation of macro calls to work, the macros must be
defined in Lisp when the calls to them are compiled. The compiler has a
special feature to help you do this: if a file being compiled contains a
@code{defmacro} form, the macro is defined temporarily for the rest of
the compilation of that file. To use this feature, you must define the
macro in the same file where it is used and before its first use.
----------------------------------------------------------------
Here are some results using the byte-compiler in xemacs 21.1:
----------------------------------------------------------------
(defmacro ccc () 3)
(eval-when-compile
(message "%d" (ccc)))
----------------------------------------------------------------
byte-compile-buffer ==> 3 ;; fulfills promise
----------------------------------------------------------------
(defmacro ccc () 3)
(eval-and-compile
(message "%d" (ccc)))
----------------------------------------------------------------
byte-compile-buffer ==> !! Symbol's function definition is void ((ccc))
;;; breaks promise
;;; eval-and-compile works differently from eval-when-compile
----------------------------------------------------------------
(defmacro ccc () 3)
(eval-when-compile
(message "%d" (symbol-function 'ccc)))
----------------------------------------------------------------
byte-compile-buffer ==> !! Symbol's function definition is void ((ccc))
;;; breaks promise
----------------------------------------------------------------
(eval-when-compile
(or (fboundp '+)
(defsubst + (&rest nums) (apply my-+ nums))))
----------------------------------------------------------------
byte-compile-buffer ==> !! error (("`+' is a primitive"))
;;; User should be able to do anything in a non-executed part of an eval-when-compile