aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Abrahamsen2018-04-08 16:49:20 -0700
committerEric Abrahamsen2018-04-13 10:56:55 -0700
commitffbb4e8d542df44ced5afd89221b0dfb234d8525 (patch)
tree60371b2a8b54396378a029e724f36eee9e367605
parentde28ae70effd64755e7543fd2cef90f8de5d8019 (diff)
downloademacs-ffbb4e8d542df44ced5afd89221b0dfb234d8525.tar.gz
emacs-ffbb4e8d542df44ced5afd89221b0dfb234d8525.zip
Further fix to eieio-persistent
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-validate/fix-slot-value): Make handling of hash tables and vectors recursive. This is necessary because the write process, in `eieio-override-prin1' is also recursive. With any luck, this will be the last fix of its kind. If that's true, cherry-pick to Emacs 26.2 later on.
-rw-r--r--lisp/emacs-lisp/eieio-base.el32
1 files changed, 15 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index 9f9f870a757..75709ddc0a8 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -360,32 +360,30 @@ Second, any text properties will be stripped from strings."
360 proposed-value)))) 360 proposed-value))))
361 ;; For hash-tables and vectors, the top-level `read' will not 361 ;; For hash-tables and vectors, the top-level `read' will not
362 ;; "look inside" member values, so we need to do that 362 ;; "look inside" member values, so we need to do that
363 ;; explicitly. 363 ;; explicitly. Because `eieio-override-prin1' is recursive in
364 ;; the case of hash-tables and vectors, we recurse
365 ;; `eieio-persistent-validate/fix-slot-value' here as well.
364 ((hash-table-p proposed-value) 366 ((hash-table-p proposed-value)
365 (maphash 367 (maphash
366 (lambda (key value) 368 (lambda (key value)
367 (cond ((class-p (car-safe value)) 369 (setf (gethash key proposed-value)
368 (setf (gethash key proposed-value) 370 (if (class-p (car-safe value))
369 (eieio-persistent-convert-list-to-object 371 (eieio-persistent-convert-list-to-object
370 value))) 372 value)
371 ((and (consp value) 373 (eieio-persistent-validate/fix-slot-value
372 (eq (car value) 'quote)) 374 class slot value))))
373 (setf (gethash key proposed-value)
374 (cadr value)))))
375 proposed-value) 375 proposed-value)
376 proposed-value) 376 proposed-value)
377 377
378 ((vectorp proposed-value) 378 ((vectorp proposed-value)
379 (dotimes (i (length proposed-value)) 379 (dotimes (i (length proposed-value))
380 (let ((val (aref proposed-value i))) 380 (let ((val (aref proposed-value i)))
381 (cond ((class-p (car-safe val)) 381 (aset proposed-value i
382 (aset proposed-value i 382 (if (class-p (car-safe val))
383 (eieio-persistent-convert-list-to-object 383 (eieio-persistent-convert-list-to-object
384 (aref proposed-value i)))) 384 val)
385 ((and (consp val) 385 (eieio-persistent-validate/fix-slot-value
386 (eq (car val) 'quote)) 386 class slot val)))))
387 (aset proposed-value i
388 (cadr val))))))
389 proposed-value) 387 proposed-value)
390 388
391 ((stringp proposed-value) 389 ((stringp proposed-value)