From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Ludlam Newsgroups: gmane.emacs.devel Subject: eieio-base patch to support EDE project loading Date: Mon, 30 Sep 2019 22:18:24 -0400 Message-ID: <8d7cb453-41c9-f3eb-8395-01cb46079663@siege-engine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="201163"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 To: Emacs Development Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 01 04:18:43 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iF7kQ-000q9k-Am for ged-emacs-devel@m.gmane.org; Tue, 01 Oct 2019 04:18:42 +0200 Original-Received: from localhost ([::1]:58614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iF7kO-0005ce-Em for ged-emacs-devel@m.gmane.org; Mon, 30 Sep 2019 22:18:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53645) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iF7kD-0005cF-95 for emacs-devel@gnu.org; Mon, 30 Sep 2019 22:18:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iF7kC-0006vr-52 for emacs-devel@gnu.org; Mon, 30 Sep 2019 22:18:29 -0400 Original-Received: from mail-qk1-f193.google.com ([209.85.222.193]:43134) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iF7kB-0006uo-TT for emacs-devel@gnu.org; Mon, 30 Sep 2019 22:18:28 -0400 Original-Received: by mail-qk1-f193.google.com with SMTP id h126so9723105qke.10 for ; Mon, 30 Sep 2019 19:18:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=hpPOT8ULPAHVw1orgzPOuVtxtV8061BAUdQV8hShbcs=; b=LJmQbolUVZAGF1Ri1piI4CMazUFTc99V5fbPVLrdybEGJw5tKyXB3LnxaIAkzTnjyT 9Il7J9vUONWmFboH8jZNLwlNeuuFXMZjsDaUjRXB/5D9X6qiYxAdCtKWFU8CUDVTGHDz C37JCSfQyLg5WPC8dSqWHpZkFcZv1otsejFqlogbMwjdNncbfb8j1yQZ5Hr0hBX2+0TR InQhPKi4ssa80t9Za41HPpC90RuY3I0GBiMVmL/cPLvU5ONKwGVWVari7VOrXC+eOf0S 6zuWC9KmOyKw+El0OYYoSmcsb2nBKp6bcYt8IGG8sI8woSBfweAxrUttIjTWxJO31k9t 23QQ== X-Gm-Message-State: APjAAAW7uour3oGz/mVVlf1IKXCJ9qPLMe/6/nF9y/xOHkhwB6f2yO2N I/37V0/KnhCPJ7HOswN8tI4nSrVgf3U= X-Google-Smtp-Source: APXvYqzCf5tsb39Ehm8Ki44Ma4TqOVPLdacaRC4m8TCTkBSBHmxZourZYahrOG5FRGfTAh7adiKQGw== X-Received: by 2002:a05:620a:24f:: with SMTP id q15mr3374213qkn.343.1569896305932; Mon, 30 Sep 2019 19:18:25 -0700 (PDT) Original-Received: from [192.168.1.202] (pool-108-20-30-136.bstnma.fios.verizon.net. [108.20.30.136]) by smtp.googlemail.com with ESMTPSA id j2sm6993465qki.15.2019.09.30.19.18.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Sep 2019 19:18:25 -0700 (PDT) Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.222.193 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:240416 Archived-At: 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))))