emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] feature/gnus-select 9d4baa3 165/218: Let eieio-persistent-


From: Andrew G Cohen
Subject: [Emacs-diffs] feature/gnus-select 9d4baa3 165/218: Let eieio-persistent-read read what object-write has written
Date: Fri, 14 Dec 2018 03:35:22 -0500 (EST)

branch: feature/gnus-select
commit 9d4baa3de68bd2125b84f2e51be36bf9f87c5188
Author: Eric Abrahamsen <address@hidden>
Commit: Andrew G Cohen <address@hidden>

    Let eieio-persistent-read read what object-write has written
    
    * lisp/emacs-lisp/eieio-base.el (eieio-persistent-validate/fix-slot-value):
      `object-write' may quote lists inside hash tables and vectors, so
      unquote those lists here.
    
    This patch allows the eieio-persistent write/restore process to
    perform a clean round trip. It only handles a very specific and
    limited range of object structures, but at least the write and read
    procedures match.
---
 lisp/emacs-lisp/eieio-base.el | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index adc53e3..3a78877 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -360,19 +360,28 @@ Second, any text properties will be stripped from 
strings."
         ((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))))
+            (cond ((class-p (car-safe value))
+                   (setf (gethash key proposed-value)
+                         (eieio-persistent-convert-list-to-object
+                          value)))
+                  ((and (consp value)
+                        (eq (car value) 'quote))
+                   (setf (gethash key proposed-value)
+                         (cadr 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)))))
+           (let ((val (aref proposed-value i)))
+            (cond ((class-p (car-safe val))
+                   (aset proposed-value i
+                         (eieio-persistent-convert-list-to-object
+                          (aref proposed-value i))))
+                  ((and (consp val)
+                        (eq (car val) 'quote))
+                   (aset proposed-value i
+                         (cadr val))))))
          proposed-value)
 
         ((stringp proposed-value)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]