]> code.delx.au - gnu-emacs/blobdiff - lisp/custom.el
* todos.el (todos-modes-set-2): Restore point after finding start
[gnu-emacs] / lisp / custom.el
index d8909f8be927c67e6893dbef5a37a5356dba36e6..1f0729cfd971d00224960a80f4cc1a9f042a31bf 100644 (file)
@@ -120,7 +120,9 @@ 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."
+function, and another one setting the standard-value property.
+Or you can wrap the defcustom in a progn, to force the autoloader
+to include all of it."            ; see eg vc-sccs-search-project-dir
   ;; No longer true:
   ;; "See `send-mail-function' in sendmail.el for an example."
 
@@ -335,7 +337,7 @@ for more information."
          ;; expression is checked by the byte-compiler, and that
          ;; lexical-binding is obeyed, so quote the expression with
          ;; `lambda' rather than with `quote'.
-         `(list (lambda () ,standard))
+         ``(funcall #',(lambda () ,standard))
        `',standard)
     ,doc
     ,@args))
@@ -609,7 +611,7 @@ property, or (ii) an alias for another customizable variable."
     (or (get variable 'standard-value)
        (get variable 'custom-autoload))))
 
-(define-obsolete-function-alias 'user-variable-p 'custom-variable-p "24.2")
+(define-obsolete-function-alias 'user-variable-p 'custom-variable-p "24.3")
 
 (defun custom-note-var-changed (variable)
   "Inform Custom that VARIABLE has been set (changed).
@@ -936,16 +938,21 @@ Each of the arguments in ARGS should be a list of this form:
 
   (SYMBOL EXP [NOW [REQUEST [COMMENT]]])
 
-This stores EXP (without evaluating it) as the saved value for SYMBOL.
-If NOW is present and non-nil, then also evaluate EXP and set
-the default value for the SYMBOL to the value of EXP.
+SYMBOL is the variable name, and EXP is an expression which
+evaluates to the customized value.  EXP will also be stored,
+without evaluating it, in SYMBOL's `saved-value' property, so
+that it can be restored via the Customize interface.  It is also
+added to the alist in SYMBOL's `theme-value' property \(by
+calling `custom-push-theme').
 
-REQUEST is a list of features we must require in order to
-handle SYMBOL properly.
-COMMENT is a comment string about SYMBOL.
+NOW, if present and non-nil, means to install the variable's
+value directly now, even if its `defcustom' declaration has not
+been executed.  This is for internal use only.
+
+REQUEST is a list of features to `require' (which are loaded
+prior to evaluating EXP).
 
-EXP itself is saved unevaluated as SYMBOL property `saved-value' and
-in SYMBOL's list property `theme-value' \(using `custom-push-theme')."
+COMMENT is a comment string about SYMBOL."
   (custom-check-theme theme)
 
   ;; Process all the needed autoloads before anything else, so that the
@@ -1043,6 +1050,7 @@ The optional argument DOC is a doc string describing the theme.
 
 Any theme `foo' should be defined in a file called `foo-theme.el';
 see `custom-make-theme-feature' for more information."
+  (declare (doc-string 2))
   (let ((feature (custom-make-theme-feature theme)))
     ;; It is better not to use backquote in this file,
     ;; because that makes a bootstrapping problem
@@ -1215,38 +1223,19 @@ Return t if THEME was successfully loaded, nil otherwise."
   "Query the user about loading a Custom theme that may not be safe.
 The theme should be in the current buffer.  If the user agrees,
 query also about adding HASH to `custom-safe-themes'."
-  (if noninteractive
-      nil
-    (let ((exit-chars '(?y ?n ?\s))
-         window prompt char)
-      (save-window-excursion
-       (rename-buffer "*Custom Theme*" t)
-       (emacs-lisp-mode)
-       (setq window (display-buffer (current-buffer)))
-       (setq prompt
-             (format "Loading a theme can run Lisp code.  Really load?%s"
-                     (if (and window
-                              (< (line-number-at-pos (point-max))
-                                 (window-body-height)))
-                         " (y or n) "
-                       (push ?\C-v exit-chars)
-                       "\nType y or n, or C-v to scroll: ")))
-       (goto-char (point-min))
-       (while (null char)
-         (setq char (read-char-choice prompt exit-chars))
-         (when (eq char ?\C-v)
-           (if window
-               (with-selected-window window
-                 (condition-case nil
-                     (scroll-up)
-                   (error (goto-char (point-min))))))
-           (setq char nil)))
-       (when (memq char '(?\s ?y))
-         ;; Offer to save to `custom-safe-themes'.
-         (and (or custom-file user-init-file)
-              (y-or-n-p "Treat this theme as safe in future sessions? ")
-              (customize-push-and-save 'custom-safe-themes (list hash)))
-         t)))))
+  (unless noninteractive
+    (save-window-excursion
+      (rename-buffer "*Custom Theme*" t)
+      (emacs-lisp-mode)
+      (pop-to-buffer (current-buffer))
+      (goto-char (point-min))
+      (prog1 (when (y-or-n-p "Loading a theme can run Lisp code.  Really load? ")
+              ;; Offer to save to `custom-safe-themes'.
+              (and (or custom-file user-init-file)
+                   (y-or-n-p "Treat this theme as safe in future sessions? ")
+                   (customize-push-and-save 'custom-safe-themes (list hash)))
+              t)
+       (quit-window)))))
 
 (defun custom-theme-name-valid-p (name)
   "Return t if NAME is a valid name for a Custom theme, nil otherwise.