diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el index 58dcd09d7e..840f7223c4 100644 --- a/lisp/emacs-lisp/eieio-base.el +++ b/lisp/emacs-lisp/eieio-base.el @@ -354,15 +354,34 @@ eieio-persistent-validate/fix-slot-value proposed-value)) (t proposed-value)))) + ((stringp proposed-value) + ;; Remove string properties. + (substring-no-properties proposed-value)) + + ;; For hash-tables and vectors, the top-level `read' will not + ;; "look inside" member values, so we need to do that + ;; explicitly. + ((hash-table-p proposed-value) + (maphash + (lambda (key value) + (when (class-p (car-safe value)) + (setf (gethash key proposed-value) + (eieio-persistent-convert-list-to-object + value)))) + proposed-value) + proposed-value) + + ((vectorp proposed-value) + (dotimes (i (length proposed-value)) + (when (class-p (car-safe (aref proposed-value i))) + (aset proposed-value i + (eieio-persistent-convert-list-to-object + (aref proposed-value i))))) + proposed-value) - ((stringp proposed-value) - ;; Else, check for strings, remove properties. - (substring-no-properties proposed-value)) - - (t - ;; Else, just return whatever the constant was. - proposed-value)) - ) + (t + ;; Else, just return whatever the constant was. + proposed-value))) (defun eieio-persistent-slot-type-is-class-p (type) "Return the class referred to in TYPE. diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index d0d2ff5145..11637c8072 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el @@ -926,6 +926,23 @@ eieio-override-prin1 (object-write thing)) ((consp thing) (eieio-list-prin1 thing)) + ((hash-table-p thing) + (maphash + (lambda (key val) + (setf (gethash key thing) + (read + (with-output-to-string + (temp-eieio-override-prin1 val))))) + thing) + (prin1 thing)) + ((vectorp thing) + (dotimes (i (length thing)) + (aset thing i + (read + (with-output-to-string + (temp-eieio-override-prin1 + (aref thing i)))))) + (prin1 thing)) ((eieio--class-p thing) (princ (eieio--class-print-name thing))) (t (prin1 thing))))