[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strange error from global-ede-mode
From: |
Stephen Leake |
Subject: |
Re: strange error from global-ede-mode |
Date: |
Sun, 13 Sep 2015 08:45:26 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt) |
Stefan Monnier <address@hidden> writes:
>> (cl-check-type obj (or eieio-object class))
>
> I think the patch below will fix it,
That helps, but then it throws a different error:
No applicable method for %S: slot-missing, [cl-struct-eieio--class
ede-project "Top level EDE project specification. ...
This is because of the logic in eieio-oref-default;
(defun eieio-oref-default (obj slot)
"Do the work for the macro `oref-default' with similar parameters.
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))))
(c (eieio--slot-name-index cl slot)))
If "obj" is a class, then "cl" should just be "obj", not
"(eieio--object-class obj)".
In Emacs 24.5, that logic is:
(let* ((cl (if (eieio-object-p obj) (eieio--object-class obj) obj))
(c (eieio-slot-name-index cl obj slot)))
As I suggest above.
So the full patch is:
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
index 3b07c5d..e0b7770 100644
--- a/lisp/emacs-lisp/eieio-core.el
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -135,10 +135,10 @@ Currently under control of this var:
(or (cl--find-class class) class)
class))
-(defun class-p (class)
- "Return non-nil if CLASS is a valid class vector.
-CLASS is a symbol." ;FIXME: Is it a vector or a symbol?
- (and (symbolp class) (eieio--class-p (cl--find-class class))))
+(defun class-p (x)
+ "Return non-nil if X is a valid class vector.
+X can also be is a symbol."
+ (eieio--class-p (if (symbolp x) (cl--find-class x) x)))
(defun eieio--class-print-name (class)
"Return a printed representation of CLASS."
@@ -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.
That fixes my original problem; I'll commit this.
We should also provide a "slot-missing" implementation for something
here, so future errors of this sort will give a better error message.
But apparently that's supposed to be provided by
eieio-default-superclass; I'll leave that for later.
--
-- Stephe