comparison lisp/custom.el @ 64200:25277c60733f

(custom-initialize-safe-set, custom-initialize-safe-default): New functions.
author Luc Teirlinck <teirllm@auburn.edu>
date Sun, 10 Jul 2005 16:32:59 +0000
parents 8633ed45b13c
children 38b6647b9ed4
comparison
equal deleted inserted replaced
64199:9e93a9a7409a 64200:25277c60733f
73 (funcall (or (get symbol 'custom-set) 'set-default) 73 (funcall (or (get symbol 'custom-set) 'set-default)
74 symbol 74 symbol
75 (if (get symbol 'saved-value) 75 (if (get symbol 'saved-value)
76 (eval (car (get symbol 'saved-value))) 76 (eval (car (get symbol 'saved-value)))
77 (eval value))))) 77 (eval value)))))
78
79 (defun custom-initialize-safe-set (symbol value)
80 "Like `custom-initialize-set', but catches errors.
81 If an error occurs during initialization, SYMBOL is set to nil
82 and no error is thrown. This is meant for use in pre-loaded files
83 where some variables used to compute VALUE are not yet defined.
84 You can then re-evaluate VALUE in startup.el, for instance using
85 `custom-reevaluate-setting'."
86 (condition-case nil
87 (custom-initialize-set symbol value)
88 (error (set-default symbol nil))))
89
90 (defun custom-initialize-safe-default (symbol value)
91 "Like `custom-initialize-default', but catches errors.
92 If an error occurs during initialization, SYMBOL is set to nil
93 and no error is thrown. This is meant for use in pre-loaded files
94 where some variables used to compute VALUE are not yet defined.
95 You can then re-evaluate VALUE in startup.el, for instance using
96 `custom-reevaluate-setting'."
97 (condition-case nil
98 (custom-initialize-default symbol value)
99 (error (set-default symbol nil))))
78 100
79 (defun custom-initialize-reset (symbol value) 101 (defun custom-initialize-reset (symbol value)
80 "Initialize SYMBOL based on VALUE. 102 "Initialize SYMBOL based on VALUE.
81 Set the symbol, using its `:set' function (or `set-default' if it has none). 103 Set the symbol, using its `:set' function (or `set-default' if it has none).
82 The value is either the symbol's current value 104 The value is either the symbol's current value