* lisp/emacs-lisp/eieio-core.el (eieio-oset-default): Catch the unexpected

case where the default value would be re-interpreted as a form!
This commit is contained in:
Stefan Monnier 2015-02-09 10:49:43 -05:00
parent af560cd6f1
commit 699ece2757
2 changed files with 7 additions and 0 deletions

View file

@ -1010,6 +1010,8 @@ Fills in the default value in CLASS' in SLOT with VALUE."
(signal 'invalid-slot-name (list (eieio--class-symbol class) slot)))
(eieio--validate-slot-value class c value slot)
;; Set this into the storage for defaults.
(if (eieio-eval-default-p value)
(error "Can't set default to a sexp that gets evaluated again"))
(setcar (nthcdr (- c (eval-when-compile eieio--object-num-slots))
(eieio--class-public-d class))
value)