Function: custom-variable-reset-backup

custom-variable-reset-backup is a byte-compiled function defined in cus-edit.el.gz.

Signature

(custom-variable-reset-backup WIDGET)

Documentation

Restore the backup value for the variable being edited by WIDGET.

The value that was current before this operation becomes the backup value, so you can use this operation repeatedly to switch between two values.

Source Code

;; Defined in /usr/src/emacs/lisp/cus-edit.el.gz
(defun custom-variable-reset-backup (widget)
  "Restore the backup value for the variable being edited by WIDGET.
The value that was current before this operation
becomes the backup value, so you can use this operation repeatedly
to switch between two values."
  (let* ((symbol (widget-value widget))
	 (set (or (get symbol 'custom-set) 'set-default))
	 (value (get symbol 'backup-value))
	 (comment-widget (widget-get widget :comment-widget))
	 (comment (widget-value comment-widget)))
    (if value
	(progn
	  (custom-variable-backup-value widget)
	  (custom-push-theme 'theme-value symbol 'user 'set value)
	  (condition-case nil
	      (funcall set symbol (car value))
	     (error nil)))
      (user-error "No backup value for %s" symbol))
    (put symbol 'customized-value (list (custom-quote (car value))))
    (put symbol 'variable-comment comment)
    (put symbol 'customized-variable-comment comment)
    (custom-variable-state-set widget)
    ;; This call will possibly make the comment invisible
    (custom-redraw widget)))