Function: eieio-set-defaults
eieio-set-defaults is a byte-compiled function defined in
eieio-core.el.gz.
Signature
(eieio-set-defaults OBJ &optional SET-ALL)
Documentation
Take object OBJ, and reset all slots to their defaults.
If SET-ALL is non-nil, then when a default is nil, that value is reset. If SET-ALL is nil, the slots are only reset if the default is not nil.
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/eieio-core.el.gz
;;;
;; Way to assign slots based on a list. Used for constructors, or
;; even resetting an object at run-time
;;
(defun eieio-set-defaults (obj &optional set-all)
"Take object OBJ, and reset all slots to their defaults.
If SET-ALL is non-nil, then when a default is nil, that value is
reset. If SET-ALL is nil, the slots are only reset if the default is
not nil."
(let ((slots (eieio--class-slots (eieio--object-class obj))))
(dotimes (i (length slots))
(let* ((name (cl--slot-descriptor-name (aref slots i)))
(df (eieio-oref-default obj name)))
(if (or df set-all)
(eieio-oset obj name df))))))