[Top][All Lists]

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

Re: defcustom and autoload

From: Daniel Jensen
Subject: Re: defcustom and autoload
Date: Sat, 09 Jun 2007 14:40:06 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux)

address@hidden writes:

> I have not generated the foo-autoloads until now, because during
> development I always load the code in toto from my .emacs.  But now I
> have tried that, and I found that the settings I have in the custom-
> set-variables block in my .emacs get overriden later when I load the
> foo-autoloads.  This despite the fact that foo-autoloads seems to
> contain defvar forms - which should refrain from setting a variable
> that is already set.  What is special about the variable settings done
> by custom-set-variables that makes them "soft" this way?

You are correct in assuming that defvar will not bind variables that
have values. The problem is that the variables were not bound initially.
You have to load the autoloads /before/ you use custom-set-variables,
unless you specify that the variables should be bound immediately:

(custom-set-variables '(foo 42 t))      ; t means set it now

> Then I looked at the Elisp files that come with Emacs.  I haven't gone
> through all of them, but it seems almost *none* of them specify
> autoloading for their defcustoms.

Try loaddefs.el.

>   What gives?  Are users really
> expected to load the whole library (and that assumes they know which
> one) before being able to customize a variable in it?

In Emacs 22, the autoload cookie will automatically generate a
custom-autoload form for defcustom, in addition to the defvar form.

reply via email to

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