[Top][All Lists]

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

Re: strange error from global-ede-mode

From: Stefan Monnier
Subject: Re: strange error from global-ede-mode
Date: Tue, 15 Sep 2015 13:23:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> @@ -766,7 +766,8 @@ Fills in OBJ's SLOT with its default value."
>    (cl-check-type obj (or eieio-object class))
>    (cl-check-type slot symbol)
>    (let* ((cl (cond ((symbolp obj) (cl--find-class obj))
> -                   (t (eieio--object-class obj))))
> +                   ((eieio-object-p obj) (eieio--object-class obj))
> +                   (t obj)))
>        (c (eieio--slot-name-index cl slot)))
>      (if (not c)
>       ;; It might be missing because it is a :class allocated slot.

Thanks, that looks good.

> That fixes my original problem; I'll commit this.

Please do.

> We should also provide a "slot-missing" implementation for something
> here, so future errors of this sort will give a better error message.

I guess we could simply do.


diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
index 790e8bc..8c37f8c 100644
--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -768,7 +768,7 @@ dynamically set from SLOTS."
 (cl-defgeneric slot-missing (object slot-name operation &optional new-value)
   "Method invoked when an attempt to access a slot in OBJECT fails.")
-(cl-defmethod slot-missing ((object eieio-default-superclass) slot-name
+(cl-defmethod slot-missing (object slot-name
                         _operation &optional _new-value)
   "Method invoked when an attempt to access a slot in OBJECT fails.
 SLOT-NAME is the name of the failed slot, OPERATION is the type of access
@@ -777,8 +777,9 @@ to be set.
 This method is called from `oref', `oset', and other functions which
 directly reference slots in EIEIO objects."
-  (signal 'invalid-slot-name (list (eieio-object-name object)
-                                  slot-name)))
+  (signal 'invalid-slot-name
+          (list (if (eieio-object-p object) (eieio-object-name object) object)
+                slot-name)))
 (cl-defgeneric slot-unbound (object class slot-name fn)
   "Slot unbound is invoked during an attempt to reference an unbound slot.")

reply via email to

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