summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2018-03-22 07:50:37 -0700
committerGlenn Morris <rgm@gnu.org>2018-03-22 07:50:37 -0700
commit0afb436eeb9b87dbd13b012e3b13d51fc6745f0d (patch)
tree683cf853c6bc6065a5f5a3d9ae81feda1882da95 /lisp/emacs-lisp
parent081c39beb0340f5d6084dc90796ba726a52c928e (diff)
parent8ac621bb5594786c66cc724864e6037c8c650774 (diff)
downloademacs-0afb436eeb9b87dbd13b012e3b13d51fc6745f0d.tar.gz
emacs-0afb436eeb9b87dbd13b012e3b13d51fc6745f0d.tar.bz2
emacs-0afb436eeb9b87dbd13b012e3b13d51fc6745f0d.zip
Merge from origin/emacs-26
8ac621b (origin/emacs-26) Document DEFUN attributes 16d0cc7 * etc/NEWS: Add an entry for auth-source-pass. cc1702f Fix the MSDOS build daa9e85 Improve warning and error messages 7612dd1 Adjust eieio persistence tests for expected failure f0cf4dc Let eieio-persistent-read read what object-write has written 40ad1ff Handle possible classtype values in eieio-persistent-read 4ec935d Add new tests for eieio persistence 47917d8 * lisp/gnus/gnus-cloud.el (gnus-cloud-synced-files): Fix doc ... e32f352 * lisp/ibuf-ext.el (ibuffer-never-search-content-mode): Fix t... 5268f30 * doc/lispref/windows.texi (Selecting Windows): Fix a typo. 143b485 * doc/lispref/internals.texi (Writing Emacs Primitives): Fix ... 4ab4551 Firm up documentation of generalized variables a5bf099 Improve documentation of Auto-Revert mode ed05eaa Improvements in dired.texi Conflicts: etc/NEWS
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/eieio-base.el47
1 files changed, 30 insertions, 17 deletions
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index c0ad7ac4605..9f9f870a757 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -219,7 +219,7 @@ for CLASS. Optional ALLOW-SUBCLASS says that it is ok for
`eieio-persistent-read' to load in subclasses of class instead of
being pedantic."
(unless class
- (message "Unsafe call to `eieio-persistent-read'."))
+ (warn "`eieio-persistent-read' called without specifying a class"))
(when class (cl-check-type class class))
(let ((ret nil)
(buffstr nil))
@@ -234,13 +234,16 @@ being pedantic."
;; the current buffer will work.
(setq ret (read buffstr))
(when (not (child-of-class-p (car ret) 'eieio-persistent))
- (error "Corrupt object on disk: Unknown saved object"))
+ (error
+ "Invalid object: %s is not a subclass of `eieio-persistent'"
+ (car ret)))
(when (and class
- (not (or (eq (car ret) class ) ; same class
- (and allow-subclass
- (child-of-class-p (car ret) class)) ; subclasses
- )))
- (error "Corrupt object on disk: Invalid saved class"))
+ (not (or (eq (car ret) class) ; same class
+ (and allow-subclass ; subclass
+ (child-of-class-p (car ret) class)))))
+ (error
+ "Invalid object: %s is not an object of class %s nor a subclass"
+ (car ret) class))
(setq ret (eieio-persistent-convert-list-to-object ret))
(oset ret file filename))
(kill-buffer " *tmp eieio read*"))
@@ -332,7 +335,8 @@ Second, any text properties will be stripped from strings."
;; We have a predicate, but it doesn't satisfy the predicate?
(dolist (PV (cdr proposed-value))
(unless (child-of-class-p (car PV) (car classtype))
- (error "Corrupt object on disk")))
+ (error "Invalid object: slot member %s does not match class %s"
+ (car PV) (car classtype))))
;; We have a list of objects here. Lets load them
;; in.
@@ -349,7 +353,7 @@ Second, any text properties will be stripped from strings."
(seq-some
(lambda (elt)
(child-of-class-p (car proposed-value) elt))
- classtype))
+ (if (listp classtype) classtype (list classtype))))
(eieio-persistent-convert-list-to-object
proposed-value))
(t
@@ -360,19 +364,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)