]> code.delx.au - gnu-emacs/blobdiff - lisp/custom.el
* lisp/simple.el (prog-mode-map): New var.
[gnu-emacs] / lisp / custom.el
index b8021bf1df6f826f1ebe9a977d531b581460b056..273c67dc66da2bcf7ce06601e4dc2d4f7d5229e5 100644 (file)
@@ -1,7 +1,7 @@
 ;;; 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
@@ -113,10 +113,17 @@ For the standard setting, use `set-default'."
 
 (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
@@ -136,7 +143,9 @@ set to nil, as the value is no longer rogue."
   (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)
@@ -297,7 +306,7 @@ _outside_ any bindings for these variables.  \(`defvar' and
 
 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.
@@ -414,7 +423,8 @@ for more information."
   ;; 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)
 
@@ -422,7 +432,10 @@ for more information."
   "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.