[Top][All Lists]

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

bug#9712: 24.0.50; doc about byte-compiling `defcustom'

From: Drew Adams
Subject: bug#9712: 24.0.50; doc about byte-compiling `defcustom'
Date: Mon, 10 Oct 2011 08:53:15 -0700

> A consequence of the current behavior is that you really 
> cannot use macro calls in VALUE, unless you are sure that
> the macro definition will be available also
> at load time (i.e., byte-compilation time is not enough).  I 
> ran into this using macro `kbd' in VALUE.

To clarify: using macro `icicle-kbd', which is similar to `kbd'.  The problem
presumably would not occur for `kbd' itself because it is in `subr.el', which is
always loaded.

E.g., put this in file throw-1.el:
(defcustom foo (eval-when-compile (toto 4))
  "jjjj" :type 'integer :group 'edit)

Put this in file throw-2.el, and evaluate it to define `toto':
(defmacro toto (n) `,n)

Byte-compile throw-1.el.

emacs -Q
M-x load-file throw-1.elc

Error: Symbol's function definition is void: toto.

Bummer.  I would think that byte-compiling would expand and evaluate macros, so
that the file defining the macros would not be needed at load/runtime if the
byte-compiled file is available.  I would expect that to be the case even
without the `eval-when-compile' (which is a specific directive to the
byte-compiler to eval and replace with the value).

reply via email to

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