Function: eieio-persistent-make-instance

eieio-persistent-make-instance is a byte-compiled function defined in eieio-base.el.gz.

Signature

(eieio-persistent-make-instance OBJCLASS INPUTLIST)

Documentation

Convert INPUTLIST, representing slot values, to an instance of OBJCLASS.

Clean slot values, and possibly recursively create additional objects found there.

Implementations

(eieio-persistent-make-instance (OBJCLASS (subclass eieio-default-superclass)) INPUTLIST) in `eieio-base.el'.

Undocumented

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/eieio-base.el.gz
(cl-defgeneric eieio-persistent-make-instance (objclass inputlist)
  "Convert INPUTLIST, representing slot values, to an instance of OBJCLASS.
Clean slot values, and possibly recursively create additional
objects found there."
  (:method
   ((objclass (subclass eieio-default-superclass)) inputlist)

   (let* ((name nil)
          (slots (if (stringp (car inputlist))
                     (progn
                       ;; Earlier versions of `object-write' added a
                       ;; string name for the object, now obsolete.
                       ;; Save as 'name' in case this object is subclass
                       ;; of eieio-named with no :object-name slot specified.
                       (setq name (car inputlist))
                       (cdr inputlist))
                   inputlist))
          (createslots nil))
     ;; If OBJCLASS is an eieio autoload object, then we need to
     ;; load it (we don't need the return value).
     (eieio--full-class-object objclass)
     (while slots
       (let ((initarg (car slots))
	     (value (car (cdr slots))))

	 ;; Strip out quotes, list functions, and update object
	 ;; constructors as needed.
	 (setq value (eieio-persistent-fix-value value))

	 (push initarg createslots)
	 (push value createslots))

       (setq slots (cdr (cdr slots))))

     (let ((newobj (apply #'make-instance objclass (nreverse createslots))))

       ;; Check for special case of subclass of `eieio-named', and do
       ;; name assignment.
       (when (and eieio-backward-compatibility
                  (object-of-class-p newobj 'eieio-named)
                  (not (oref newobj object-name))
                  name)
         (oset newobj object-name name))

       newobj))))