;;; custom.el --- tools for declaring and initializing options
;;
;; Copyright (C) 1996, 1997, 1999, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
;;
;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
;; Maintainer: FSF
(defun custom-initialize-delay (symbol value)
"Delay initialization of SYMBOL to the next Emacs start.
-This is used in files that are preloaded, so that the initialization is
-done in the run-time context rather than the build-time context.
-This also has the side-effect that the (delayed) initialization is performed
-with the :setter."
+This is used in files that are preloaded (or for autoloaded
+variables), so that the initialization is done in the run-time
+context rather than the build-time context. This also has the
+side-effect that the (delayed) initialization is performed with
+the :set function.
+
+For variables in preloaded files, you can simply use this
+function for the :initialize property. For autoloaded variables,
+you will also need to add an autoload stanza calling this
+function, and another one setting the standard-value property.
+See `send-mail-function' in sendmail.el for an example."
;; Until the var is actually initialized, it is kept unbound.
;; This seemed to be at least as good as setting it to an arbitrary
;; value like nil (evaluating `value' is not an option because it
(when (get symbol 'force-value)
(put symbol 'force-value nil))
(when doc
- (put symbol 'variable-documentation doc))
+ (if (keywordp doc)
+ (error "Doc string is missing")
+ (put symbol 'variable-documentation doc)))
(let ((initialize 'custom-initialize-reset)
(requests nil))
(unless (memq :group args)
See Info node `(elisp) Customization' in the Emacs Lisp manual
for more information."
- (declare (doc-string 3))
+ (declare (doc-string 3) (debug (name body)))
;; It is better not to use backquote in this file,
;; because that makes a bootstrapping problem
;; if you need to recompile all the Lisp files using interpreted code.
;; Record the group on the `current' list.
(let ((elt (assoc load-file-name custom-current-group-alist)))
(if elt (setcdr elt symbol)
- (push (cons load-file-name symbol) custom-current-group-alist)))
+ (push (cons (purecopy load-file-name) symbol)
+ custom-current-group-alist)))
(run-hooks 'custom-define-hook)
symbol)
"Declare SYMBOL as a customization group containing MEMBERS.
SYMBOL does not need to be quoted.
-Third arg DOC is the group documentation.
+Third argument DOC is the group documentation. This should be a short
+description of the group, beginning with a capital and ending with
+a period. Words other than the first should not be capitalized, if they
+are not usually written so.
MEMBERS should be an alist of the form ((NAME WIDGET)...) where
NAME is a symbol and WIDGET is a widget for editing that symbol.