From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Ludlam Newsgroups: gmane.emacs.devel Subject: Compatibility patches for EDE / EIEIO Date: Sun, 10 Jan 2021 11:52:50 -0500 Message-ID: <5cf47a13-e71f-6f3b-f763-335696989942@siege-engine.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------C8E5ACE06FA1EB417C4990CC" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16702"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jan 10 17:53:44 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kydyK-0004E5-Ml for ged-emacs-devel@m.gmane-mx.org; Sun, 10 Jan 2021 17:53:44 +0100 Original-Received: from localhost ([::1]:43948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kydyJ-0000pm-PH for ged-emacs-devel@m.gmane-mx.org; Sun, 10 Jan 2021 11:53:43 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33442) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kydxX-0000MR-EW for emacs-devel@gnu.org; Sun, 10 Jan 2021 11:52:55 -0500 Original-Received: from mail-qv1-f53.google.com ([209.85.219.53]:32929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kydxV-0008OA-1v for emacs-devel@gnu.org; Sun, 10 Jan 2021 11:52:54 -0500 Original-Received: by mail-qv1-f53.google.com with SMTP id a13so6541796qvv.0 for ; Sun, 10 Jan 2021 08:52:52 -0800 (PST) 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; bh=lWNGr0T9QB15w0OuoWD052Y1uKmdeQDQX1kZhnMPg7g=; b=mb8QRXo6w8dn+Q3mzBq7cBtvXwhXvY4P1dsr4rQkVdcH5tDiuLvdkoQrvQ9MmKRadL QLsTYC9aHji+hOhcAnGA8iBiKIRizwaaZlGcQjX2yHEzZKMJI0o+7LJPrY6xqq1ST71q SPNT1+Q/tt9gUTjXiJhsvQhFeuvkZWRXCrPFPCPKW3mflYCVfakHBqI4VCdu5/OdzZXS +g9AxRR20AIllSDbIn6wYoGOZzOqs+Ujpnt5aJwrNgHG4/oztoio9KuIzkriXCuAAKdL 56+sUOplpK5jT8XEBfy0b1WF5g+GJ47YPijBr3XMx1UF4yta7VHVeFDr5PEXRjW1xINd ySTA== X-Gm-Message-State: AOAM531uCYMAjohDe35EufMVqXbMuw0XaGv/PDu7/AWxABQ/CIbDiN7h hqWVK96YBVcyJ/LSKWRcTA4izv5IDbc= X-Google-Smtp-Source: ABdhPJxalxvwqy9QBgRFq//rGShJYGJo/+OqgAwlq4m6CxILU1vffHVJ/dKxuAk7YRXo8DjqI6t4hA== X-Received: by 2002:ad4:4f11:: with SMTP id fb17mr12286972qvb.46.1610297571532; Sun, 10 Jan 2021 08:52:51 -0800 (PST) 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 w127sm7264950qkb.133.2021.01.10.08.52.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 10 Jan 2021 08:52:50 -0800 (PST) Content-Language: en-US Received-SPF: pass client-ip=209.85.219.53; envelope-from=ericludlam@gmail.com; helo=mail-qv1-f53.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:262858 Archived-At: This is a multi-part message in MIME format. --------------C8E5ACE06FA1EB417C4990CC Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi, Attached are two proposed patches related to compatibility for EIEIO and EDE. The EIEIO patch helps with loading old EDE save files. It updates existing compatibility for the 1st object name argument to constructor during object loading from a file. In older versions of EIEIO, objects were saved with a 'name'. New EIEIO skips the name on load. This patch will apply the name to the :object-name slot if it is a subclass of eieio-named. This will compatibly bring in old objects and maintain the name. I tried it with the existing eieio tests which passed. The EDE patch brings over a change from the CEDET repository on Source Forge that enables project types detected via a function. The function based project types were never integrated into Emacs. This patch allows these old project types from SourceForge to work with built-in EDE. There are no uses of this feature in Emacs, but it is useful for integrating new project types that are not easily identified by a string, such as android, arduino, fitbit and other tools that usually provide their own 'studio' thing. The EDE patch was written by me before the last 'release' I had signed from my company. The EIEIO patch is new. Thanks Eric --------------C8E5ACE06FA1EB417C4990CC Content-Type: text/x-patch; charset=UTF-8; name="0001-cedet-ede-auto.el.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-cedet-ede-auto.el.patch" >From c2e4ef56934fc08746cb8fb629f67b01fbd8a734 Mon Sep 17 00:00:00 2001 From: Eric Ludlam Date: Sun, 10 Jan 2021 10:37:50 -0500 Subject: [PATCH 1/2] cedet/ede/auto.el: (ede-calc-fromconfig): New method. Support functions in addition to string matchers. (ede-dirmatch-installed, ede-do-dirmatch): Use `ede-calc-fromconfig' to do conversion. Author: Eric Ludlam --- lisp/cedet/ede/auto.el | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/lisp/cedet/ede/auto.el b/lisp/cedet/ede/auto.el index ee75e29799..e1417d7806 100644 --- a/lisp/cedet/ede/auto.el +++ b/lisp/cedet/ede/auto.el @@ -64,24 +64,22 @@ ede-project-autoload-dirmatch can be used to define that match without loading the specific project into memory.") +(cl-defmethod ede-calc-fromconfig ((dirmatch ede-project-autoload-dirmatch)) + "Calculate the value of :fromconfig from DIRMATCH." + (let* ((fc (oref dirmatch fromconfig)) + (found (cond ((stringp fc) fc) + ((functionp fc) (funcall fc)) + (t (error "Unknown dirmatch object match style."))))) + (expand-file-name found) + )) + (cl-defmethod ede-dirmatch-installed ((dirmatch ede-project-autoload-dirmatch)) "Return non-nil if the tool DIRMATCH might match is installed on the system." - (let ((fc (oref dirmatch fromconfig))) - - (cond - ;; If the thing to match is stored in a config file. - ((stringp fc) - (file-exists-p fc)) - - ;; Add new types of dirmatches here. - - ;; Error for weird stuff - (t (error "Unknown dirmatch type."))))) - + (file-exists-p (ede-calc-fromconfig dirmatch))) (cl-defmethod ede-do-dirmatch ((dirmatch ede-project-autoload-dirmatch) file) "Does DIRMATCH match the filename FILE." - (let ((fc (oref dirmatch fromconfig))) + (let ((fc (ede-calc-fromconfig dirmatch))) (cond ;; If the thing to match is stored in a config file. -- 2.25.1 --------------C8E5ACE06FA1EB417C4990CC Content-Type: text/x-patch; charset=UTF-8; name="0002-eieio-base.el.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0002-eieio-base.el.patch" >From f15b0f11c0fb9689454d687e49c1d7edbc26f0fc Mon Sep 17 00:00:00 2001 From: Eric Ludlam Date: Sun, 10 Jan 2021 10:54:49 -0500 Subject: [PATCH 2/2] eieio-base.el: (eieio-persistent-make-instance): Save the backward compatible 'name' of objects saved in the file, and if the newly loaded class inherits from 'eieio-named', restore the name of the object. Author: Eric Ludlam --- lisp/emacs-lisp/eieio-base.el | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el index 4ba72aea56..19809265ff 100644 --- a/lisp/emacs-lisp/eieio-base.el +++ b/lisp/emacs-lisp/eieio-base.el @@ -264,12 +264,17 @@ eieio-persistent-make-instance (:method ((objclass (subclass eieio-default-superclass)) inputlist) - (let ((slots (if (stringp (car inputlist)) - ;; Earlier versions of `object-write' added a - ;; string name for the object, now obsolete. - (cdr inputlist) - inputlist)) - (createslots nil)) + (let* ((name nil) + (slots (if (stringp (car inputlist)) + (progn + ;; Earlier versions of `object-write' added a + ;; string name for the object, now obsolete. + ;; Save as 'name' in case this object is subclass + ;; of eieio-named with no :object-name slot specified. + (setq name (car inputlist)) + (cdr inputlist)) + inputlist)) + (createslots nil)) ;; If OBJCLASS is an eieio autoload object, then we need to ;; load it (we don't need the return value). (eieio--full-class-object objclass) @@ -286,7 +291,17 @@ eieio-persistent-make-instance (setq slots (cdr (cdr slots)))) - (apply #'make-instance objclass (nreverse createslots))))) + (let ((newobj (apply #'make-instance objclass (nreverse createslots)))) + + ;; Check for special case of subclass of `eieio-named', and do + ;; name assignment. + (when (and eieio-backward-compatibility + (object-of-class-p newobj eieio-named) + (not (oref newobj object-name)) + name) + (oset newobj object-name name)) + + newobj)))) (defun eieio-persistent-fix-value (proposed-value) "Fix PROPOSED-VALUE. -- 2.25.1 --------------C8E5ACE06FA1EB417C4990CC--