aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2006-07-17 21:26:32 +0000
committerStefan Monnier2006-07-17 21:26:32 +0000
commitd54fbdfd31673892ac581219860a80d13f4d8ff5 (patch)
treef1759b7335704a662bcbfce616c1d73f03857409
parente0a0d9fe5c1e9110589a5d164ae1ea04f50a4191 (diff)
downloademacs-d54fbdfd31673892ac581219860a80d13f4d8ff5.tar.gz
emacs-d54fbdfd31673892ac581219860a80d13f4d8ff5.zip
(custom-autoload): Add `noset' argument.
(custom-push-theme): Don't autoload the variable, let callers do it. (custom-theme-set-variables): Autoload the variable if necessary.
-rw-r--r--lisp/custom.el31
1 files changed, 17 insertions, 14 deletions
diff --git a/lisp/custom.el b/lisp/custom.el
index c0169812d36..2e5c0a59d9b 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -558,9 +558,10 @@ LOAD should be either a library file name, or a feature name."
558 (unless (member load loads) 558 (unless (member load loads)
559 (put symbol 'custom-loads (cons (purecopy load) loads))))) 559 (put symbol 'custom-loads (cons (purecopy load) loads)))))
560 560
561(defun custom-autoload (symbol load) 561(defun custom-autoload (symbol load &optional noset)
562 "Mark SYMBOL as autoloaded custom variable and add dependency LOAD." 562 "Mark SYMBOL as autoloaded custom variable and add dependency LOAD.
563 (put symbol 'custom-autoload t) 563If NOSET is non-nil, don't bother autoloading LOAD when setting the variable."
564 (put symbol 'custom-autoload (if noset 'noset t))
564 (custom-add-load symbol load)) 565 (custom-add-load symbol load))
565 566
566;; This test is also in the C code of `user-variable-p'. 567;; This test is also in the C code of `user-variable-p'.
@@ -699,10 +700,10 @@ Return non-nil iff the `customized-value' property actually changed."
699 (customized (get symbol 'customized-value)) 700 (customized (get symbol 'customized-value))
700 (old (or (get symbol 'saved-value) (get symbol 'standard-value)))) 701 (old (or (get symbol 'saved-value) (get symbol 'standard-value))))
701 ;; Mark default value as set iff different from old value. 702 ;; Mark default value as set iff different from old value.
702 (if (or (null old) 703 (if (not (and old
703 (not (equal value (condition-case nil 704 (equal value (condition-case nil
704 (eval (car old)) 705 (eval (car old))
705 (error nil))))) 706 (error nil)))))
706 (progn (put symbol 'customized-value (list (custom-quote value))) 707 (progn (put symbol 'customized-value (list (custom-quote value)))
707 (custom-push-theme 'theme-value symbol 'user 'set 708 (custom-push-theme 'theme-value symbol 'user 'set
708 (custom-quote value))) 709 (custom-quote value)))
@@ -827,13 +828,9 @@ See `custom-known-themes' for a list of known themes."
827 (if (and (eq prop 'theme-value) 828 (if (and (eq prop 'theme-value)
828 (boundp symbol)) 829 (boundp symbol))
829 (let ((sv (get symbol 'standard-value))) 830 (let ((sv (get symbol 'standard-value)))
830 (when (and (null sv) (custom-variable-p symbol)) 831 (unless (and sv
831 (custom-load-symbol symbol) 832 (equal (eval (car sv)) (symbol-value symbol)))
832 (setq sv (get symbol 'standard-value))) 833 (setq old (list (list 'changed (symbol-value symbol))))))
833 (if (or (null sv)
834 (not (equal (eval (car (get symbol 'standard-value)))
835 (symbol-value symbol))))
836 (setq old (list (list 'changed (symbol-value symbol))))))
837 (if (and (facep symbol) 834 (if (and (facep symbol)
838 (not (face-spec-match-p symbol (get symbol 'face-defface-spec)))) 835 (not (face-spec-match-p symbol (get symbol 'face-defface-spec))))
839 (setq old (list (list 'changed (list 836 (setq old (list (list 'changed (list
@@ -907,6 +904,10 @@ in SYMBOL's list property `theme-value' \(using `custom-push-theme')."
907 (when requests 904 (when requests
908 (put symbol 'custom-requests requests) 905 (put symbol 'custom-requests requests)
909 (mapc 'require requests)) 906 (mapc 'require requests))
907 (unless (or (get symbol 'standard-value)
908 (memq (get symbol 'custom-autoload) '(nil noset)))
909 ;; This symbol needs to be autoloaded, even just for a `set'.
910 (custom-load-symbol symbol))
910 (setq set (or (get symbol 'custom-set) 'custom-set-default)) 911 (setq set (or (get symbol 'custom-set) 'custom-set-default))
911 (put symbol 'saved-value (list value)) 912 (put symbol 'saved-value (list value))
912 (put symbol 'saved-variable-comment comment) 913 (put symbol 'saved-variable-comment comment)
@@ -926,6 +927,8 @@ in SYMBOL's list property `theme-value' \(using `custom-push-theme')."
926 (setq args (cdr args)) 927 (setq args (cdr args))
927 (and (or now (default-boundp symbol)) 928 (and (or now (default-boundp symbol))
928 (put symbol 'variable-comment comment))) 929 (put symbol 'variable-comment comment)))
930 ;; I believe this is dead-code, because the `sort' code above would
931 ;; have burped before we could get here. --Stef
929 ;; Old format, a plist of SYMBOL VALUE pairs. 932 ;; Old format, a plist of SYMBOL VALUE pairs.
930 (message "Warning: old format `custom-set-variables'") 933 (message "Warning: old format `custom-set-variables'")
931 (ding) 934 (ding)