Commit 059290d6 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(custom-reevaluate-setting): Simple function to handle variables

that are defined before their default value can really be computed.
(custom-theme-set-variables): Remove unused var `immediate'.
parent 55d0f066
;;; custom.el --- tools for declaring and initializing options ;;; custom.el --- tools for declaring and initializing options
;; ;;
;; Copyright (C) 1996, 1997, 1999, 2001, 2002, 2004 ;; Copyright (C) 1996, 1997, 1999, 2001, 2002, 2004, 2005
;; Free Software Foundation, Inc. ;; Free Software Foundation, Inc.
;; ;;
;; Author: Per Abrahamsen <abraham@dina.kvl.dk> ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
...@@ -726,6 +726,15 @@ handle SYMBOL properly. ...@@ -726,6 +726,15 @@ handle SYMBOL properly.
COMMENT is a comment string about SYMBOL." COMMENT is a comment string about SYMBOL."
(apply 'custom-theme-set-variables 'user args)) (apply 'custom-theme-set-variables 'user args))
(defun custom-reevaluate-setting (symbol)
"Reset the value of SYMBOL by re-evaluating its saved or default value.
This is useful for variables that are defined before their default value
can really be computed. E.g. dumped variables whose default depends on
run-time information."
(funcall (or (get symbol 'custom-set) 'set-default)
symbol
(eval (car (or (get symbol 'saved-value) (get symbol 'standard-value))))))
(defun custom-theme-set-variables (theme &rest args) (defun custom-theme-set-variables (theme &rest args)
"Initialize variables for theme THEME according to settings in ARGS. "Initialize variables for theme THEME according to settings in ARGS.
Each of the arguments in ARGS should be a list of this form: Each of the arguments in ARGS should be a list of this form:
...@@ -753,7 +762,6 @@ SYMBOL's property `force-value' is set to the symbol `immediate'. ...@@ -753,7 +762,6 @@ SYMBOL's property `force-value' is set to the symbol `immediate'.
EXP itself is saved unevaluated as SYMBOL property `saved-value' and EXP itself is saved unevaluated as SYMBOL property `saved-value' and
in SYMBOL's list property `theme-value' \(using `custom-push-theme')." in SYMBOL's list property `theme-value' \(using `custom-push-theme')."
(custom-check-theme theme) (custom-check-theme theme)
(let ((immediate (get theme 'theme-immediate)))
(setq args (setq args
(sort args (sort args
(lambda (a1 a2) (lambda (a1 a2)
...@@ -813,7 +821,7 @@ in SYMBOL's list property `theme-value' \(using `custom-push-theme')." ...@@ -813,7 +821,7 @@ in SYMBOL's list property `theme-value' \(using `custom-push-theme')."
(value (nth 1 args))) (value (nth 1 args)))
(put symbol 'saved-value (list value)) (put symbol 'saved-value (list value))
(custom-push-theme 'theme-value symbol theme 'set value)) (custom-push-theme 'theme-value symbol theme 'set value))
(setq args (cdr (cdr args)))))))) (setq args (cdr (cdr args)))))))
(defun custom-set-default (variable value) (defun custom-set-default (variable value)
"Default :set function for a customizable variable. "Default :set function for a customizable variable.
...@@ -1091,5 +1099,5 @@ This means reset VARIABLE to its value in TO-THEME." ...@@ -1091,5 +1099,5 @@ This means reset VARIABLE to its value in TO-THEME."
(provide 'custom) (provide 'custom)
;;; arch-tag: 041b6116-aabe-4f9a-902d-74092bc3dab2 ;; arch-tag: 041b6116-aabe-4f9a-902d-74092bc3dab2
;;; custom.el ends here ;;; custom.el ends here
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment