emacs-devel
[Top][All Lists]
Advanced

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

defcustom standard value and byte-compilation


From: Tassilo Horn
Subject: defcustom standard value and byte-compilation
Date: Tue, 10 Mar 2015 13:04:39 +0100
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

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



reply via email to

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