diff options
| author | Eric Abrahamsen | 2017-12-28 18:14:47 -0800 |
|---|---|---|
| committer | Eric Abrahamsen | 2018-03-22 10:46:08 +0800 |
| commit | f0cf4dc62918a5acd2c6bbade78909cfa73ca9c8 (patch) | |
| tree | bf38688abd9a56e8acc6e6eb3d19e9d77ab3951d | |
| parent | 40ad1ff327616721ce060ea774631b54e3ba26ca (diff) | |
| download | emacs-f0cf4dc62918a5acd2c6bbade78909cfa73ca9c8.tar.gz emacs-f0cf4dc62918a5acd2c6bbade78909cfa73ca9c8.zip | |
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.
| -rw-r--r-- | lisp/emacs-lisp/eieio-base.el | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el index af240794e38..5ff8574d9a9 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." | |||
| 360 | ((hash-table-p proposed-value) | 360 | ((hash-table-p proposed-value) |
| 361 | (maphash | 361 | (maphash |
| 362 | (lambda (key value) | 362 | (lambda (key value) |
| 363 | (when (class-p (car-safe value)) | 363 | (cond ((class-p (car-safe value)) |
| 364 | (setf (gethash key proposed-value) | 364 | (setf (gethash key proposed-value) |
| 365 | (eieio-persistent-convert-list-to-object | 365 | (eieio-persistent-convert-list-to-object |
| 366 | value)))) | 366 | value))) |
| 367 | ((and (consp value) | ||
| 368 | (eq (car value) 'quote)) | ||
| 369 | (setf (gethash key proposed-value) | ||
| 370 | (cadr value))))) | ||
| 367 | proposed-value) | 371 | proposed-value) |
| 368 | proposed-value) | 372 | proposed-value) |
| 369 | 373 | ||
| 370 | ((vectorp proposed-value) | 374 | ((vectorp proposed-value) |
| 371 | (dotimes (i (length proposed-value)) | 375 | (dotimes (i (length proposed-value)) |
| 372 | (when (class-p (car-safe (aref proposed-value i))) | 376 | (let ((val (aref proposed-value i))) |
| 373 | (aset proposed-value i | 377 | (cond ((class-p (car-safe val)) |
| 374 | (eieio-persistent-convert-list-to-object | 378 | (aset proposed-value i |
| 375 | (aref proposed-value i))))) | 379 | (eieio-persistent-convert-list-to-object |
| 380 | (aref proposed-value i)))) | ||
| 381 | ((and (consp val) | ||
| 382 | (eq (car val) 'quote)) | ||
| 383 | (aset proposed-value i | ||
| 384 | (cadr val)))))) | ||
| 376 | proposed-value) | 385 | proposed-value) |
| 377 | 386 | ||
| 378 | ((stringp proposed-value) | 387 | ((stringp proposed-value) |