all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* defcustom standard value and byte-compilation
@ 2015-03-10 12:04 Tassilo Horn
  2015-03-11  0:46 ` Stefan Monnier
  0 siblings, 1 reply; 14+ messages in thread
From: Tassilo Horn @ 2015-03-10 12:04 UTC (permalink / raw)
  To: emacs-devel

Hi all,

I just found out that the form defining the standard value of a
defcustom is not subject to byte-compilation.  The problem with that is
that you can't use macros in there without having to require the file
providing the macro at load-time, too.

This is the concrete example in AUCTeX's tex.el:

--8<---------------cut here---------------start------------->8---
(eval-when-compile (require 'cl))

(defcustom TeX-style-path
  (let ((path))
    (mapc (lambda (file) (when file (pushnew file path)))
          (append (list TeX-auto-global TeX-style-global)
                  TeX-auto-private TeX-style-private
                  (list TeX-auto-local TeX-style-local)))
    (nreverse path))
  ;; docs & keywords
  )
--8<---------------cut here---------------end--------------->8---

In the byte-compiled tex.elc, the reference to pushnew is still there
and you get an error when loading tex.el and cl hasn't been required
beforehand.

I fixed this concrete situation by using `member' and `cons' instead of
`pushnew' but IMHO this behavior is at the very least surprising.  I can
use macros in functions and init-forms of defvars and defconsts and they
are all compiled away, so why shouldn't I allowed to do the same for
defcustoms?

Also, I don't find a note on that behavior in the docs.

Bye,
Tassilo



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-03-12 14:10 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-10 12:04 defcustom standard value and byte-compilation Tassilo Horn
2015-03-11  0:46 ` Stefan Monnier
2015-03-11  7:18   ` Tassilo Horn
2015-03-11 13:54     ` Stefan Monnier
2015-03-11 15:04       ` Tassilo Horn
2015-03-11 18:56         ` Stefan Monnier
2015-03-11 20:27           ` Drew Adams
2015-03-12  7:43             ` Tassilo Horn
2015-03-12 13:29               ` Drew Adams
2015-03-12 14:04                 ` Andreas Schwab
2015-03-12 14:10                   ` Drew Adams
2015-03-12 13:22             ` Stefan Monnier
2015-03-12  4:05         ` Stephen J. Turnbull
2015-03-12  7:31           ` Tassilo Horn

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.