emacs-devel
[Top][All Lists]
Advanced

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

eieio-base patch to support EDE project loading


From: Eric Ludlam
Subject: eieio-base patch to support EDE project loading
Date: Mon, 30 Sep 2019 22:18:24 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Hi,

I've spent the last few years on emacs24, and just recently updated to newer version, and also attempted to switch to using built-in CEDET at the same time. (I'd been using sourceforge version before.) I am clearly a few years behind, hopefully you can forgive the transgression.

In so doing, I discovered I couldn't load some of my old EDE projects.
The error is in eieio-base.el (eieio-persistent-validate/fix-slot-value) with a call to `child-of-class-p' with a class being loaded that is still an autoload.

The core problem is in eieio-core.el (eieio-defclass-autoload). There is a handy comment that explains it:

;; We used to store the list of superclasses in the `parent' slot (as a list
;; of class names).  But now this slot holds a list of class objects, and
;; those parents may not exist yet, so the corresponding class objects may
;; simply not exist yet.  So instead we just don't store the list of parents
;; here in eieio-defclass-autoload at all, since it seems that they're just
;; not needed before the class is actually loaded.


Without that list of superclasses, `child-of-class-p' fails. Since having the superclass list in autoloads is a non-starter, this patch will un-autoload classes found in the file being read before the call to `child-of-class-p'.

It would be better to store the superclasses in the autoload declaration so that extensible class hierarchies can be more dynamically loaded without internal checks with un-autoload, but I don't know enough about how the new version of eieio works to provide that patch.

I didn't extensively test this beyond a couple old EDE projects of mine.

Hope this helps.

Eric (original author of eieio from a few years back)

-----


diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index 534613811d..9131263761 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -342,6 +342,10 @@ eieio-persistent-validate/fix-slot-value

                  ;; We have a predicate, but it doesn't satisfy the predicate?
                  (dolist (PV (cdr proposed-value))
+ ;; If PV is an autoload class, then we must load it before `child-of-class-p' will
+                    ;; successfully detect what it is.
+                    (eieio-class-un-autoload (car PV))
+                    ;; Test the class found in the file
                    (unless (child-of-class-p (car PV) (car classtype))
                      (error "Invalid object: slot member %s does not match class 
%s"
                              (car PV) (car classtype))))



reply via email to

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