all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* eieio-base patch to support EDE project loading
@ 2019-10-01  2:18 Eric Ludlam
  2019-10-01 12:14 ` Stefan Monnier
  2019-10-04 20:45 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Eric Ludlam @ 2019-10-01  2:18 UTC (permalink / raw)
  To: Emacs Development

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))))



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-06 20:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-01  2:18 eieio-base patch to support EDE project loading Eric Ludlam
2019-10-01 12:14 ` Stefan Monnier
2019-10-04 20:45 ` Stefan Monnier
2019-10-06 12:18   ` Eric Ludlam
2019-10-06 20:02     ` Stefan Monnier

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.