From: Eric Ludlam <eric@siege-engine.com>
To: Emacs Development <emacs-devel@gnu.org>
Subject: eieio-base patch to support EDE project loading
Date: Mon, 30 Sep 2019 22:18:24 -0400 [thread overview]
Message-ID: <8d7cb453-41c9-f3eb-8395-01cb46079663@siege-engine.com> (raw)
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))))
next reply other threads:[~2019-10-01 2:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-01 2:18 Eric Ludlam [this message]
2019-10-01 12:14 ` eieio-base patch to support EDE project loading Stefan Monnier
2019-10-04 20:45 ` Stefan Monnier
2019-10-06 12:18 ` Eric Ludlam
2019-10-06 20:02 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8d7cb453-41c9-f3eb-8395-01cb46079663@siege-engine.com \
--to=eric@siege-engine.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.