Function: custom-variable-mark-to-save
custom-variable-mark-to-save is a byte-compiled function defined in
cus-edit.el.gz.
Signature
(custom-variable-mark-to-save WIDGET)
Documentation
Set value and mark for saving the variable edited by WIDGET.
Source Code
;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-variable-mark-to-save (widget)
"Set value and mark for saving the variable edited by WIDGET."
(let* ((form (widget-get widget :custom-form))
(state (widget-get widget :custom-state))
(child (car (widget-get widget :children)))
(symbol (widget-value widget))
(set (or (get symbol 'custom-set) 'set-default))
(comment-widget (widget-get widget :comment-widget))
(comment (widget-value comment-widget))
val)
(cond ((eq state 'hidden)
(user-error "Cannot set hidden variable"))
((setq val (widget-apply child :validate))
(goto-char (widget-get val :from))
(error "Saving %s: %s" symbol (widget-get val :error)))
((memq form '(lisp mismatch))
(when (equal comment "")
(setq comment nil)
;; Make the comment invisible by hand if it's empty
(custom-comment-hide comment-widget))
(put symbol 'saved-value (list (widget-value child)))
(custom-push-theme 'theme-value symbol 'user
'set (custom-quote (widget-value child)))
(funcall set symbol (eval (widget-value child)))
(put symbol 'variable-comment comment)
(put symbol 'saved-variable-comment comment))
(t
(when (equal comment "")
(setq comment nil)
;; Make the comment invisible by hand if it's empty
(custom-comment-hide comment-widget))
(put symbol 'saved-value
(list (custom-quote (widget-value child))))
(custom-push-theme 'theme-value symbol 'user
'set (custom-quote (widget-value child)))
(funcall set symbol (widget-value child))
(put symbol 'variable-comment comment)
(put symbol 'saved-variable-comment comment)))
(put symbol 'customized-value nil)
(put symbol 'customized-variable-comment nil)))