From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: Should EDE use project.el [PATCH] Date: Mon, 16 May 2022 17:00:35 +0200 Message-ID: <20220516150035.f5yryr6uby6msfqy@Ergus> References: <20220516114643.5234do3n6zbyxv7r.ref@Ergus> <20220516114643.5234do3n6zbyxv7r@Ergus> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="fsysgh7gwpu5ovd7" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="35540"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon May 16 17:24:45 2022 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 1nqcaT-00098J-4z for ged-emacs-devel@m.gmane-mx.org; Mon, 16 May 2022 17:24:45 +0200 Original-Received: from localhost ([::1]:52114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nqcaR-0007ka-Kn for ged-emacs-devel@m.gmane-mx.org; Mon, 16 May 2022 11:24:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53526) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nqcDI-0001AI-KV for emacs-devel@gnu.org; Mon, 16 May 2022 11:00:49 -0400 Original-Received: from sonic307-2.consmr.mail.bf2.yahoo.com ([74.6.134.41]:38828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nqcDF-0001tR-84 for emacs-devel@gnu.org; Mon, 16 May 2022 11:00:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1652713242; bh=ksDhAcQG8sSnovvSIV3wA6mbMld6hEfvd6jOhUM8aq8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=Z2KJrf+66uYUZEdISxvwjsPZxsS9bokrzAEyZ+iI2FAxPF4it/U2Td6DWMt3Z0asOdqUTYIte3qcfkp748DX9aP9/0ZK2XKqIzGkkSAB7su0udP3sM7aX1h0a4gK56OSY2AOyCSt6JbF1U8ge1AN1E4e2b4emVke524wkR9GfK2CYVZDumDDJEMgz4Top1NxMtlEtI+1VvI2frxd4NgGFtEBaf/o6a47BqiKO6y/XxVObchiRYxxz4SltFo8BuMM2eS6vYxXjN+WIc9uQ7R/83yG4VWihD7QA+zw4mhbsKGVKtxf1htLM1dBSxxWjFOGiSjzTCFrPX9OpyczMxWABQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1652713242; bh=bmtCbHw9L7H/pTr3o2mem9P/823S40CZSKv23t53/Q/=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=tzu7tth1ISRoK+AKlfZn2GsqWAMXQJvsRTc27hUo3xicBOuxmQWp1JtzLan4gQOaWN+0zCR34xPgd/L4Ev3Ug5EM3//4fCIlMRfzd1jIyC2D/ueIquT6KbjATo6OIUKHnSnvbVPCgaA6i53djwoTgSCH6a4meTIgij5EBDrZE8S3zp5peIyDfYUIqdyAGnRLgKkvbvvOLYqhO0wObvC2QvbDkjp+g7j6OQMxT1WZKWUnFifvcb81LGfGQnhgMxuQOtNnw19dtKRehT8G9S9CSGU1NT9Qv2+OuXcFgr5geXEH7XL1F4fz6U5kAxitd4dQbFgg0geeK4htl8dD72ZMZQ== X-YMail-OSG: ZV9nAnoVM1kLh4WuuWsYLU8FhY5b1gupq1rZed6DDTo14Fq_UqFd1zVDkrinIrv iMR.A7OU2WRWHXB6qowkqI_SxP8Q_6JwnZDkNWpTf7BWzkEO1Njolckt8hgzf6kjbnT_53N2Ijzn brSOk7E.8A73tCTFAwMW656HMZbnAQiKI3.xsyHmyYVfEU3htxlkP1rXahz6CSCPsytsHJHHwndV ApDK9dakQoJiE9pw6BreSKLPZKQH9xwxJTKT9T0XbNatDn6drZHanAiLll0NB3txhT1pSN..xnic ViF9OIpThmZQgm73n61jdpBC5c2xd7naDhv4roZ53yQjzKPyhhvA1IYFHnUV.5pewb6PMCZWf4qL FNQlKclGGpxt5nkgOjvP2Zscd2k5rACr3tT8zf4d_KL4MVrjzeoSOPKa_SkQ_zjF3aSKr45uLpkH zK.UTUg0h1NwEXEDsgfN0EOJX6abB7cLGXF0S16QlYFp.2H6mogA1GRjjWLozIMGP3BWFsZUM5wp pWfbOhfkNEDNKlGFH2nV.VXmKPYQt_Dyw1hjJy34js0fmrFrPIW2A_9SaBuk7fkx_Jf9DC1Y9OQn LtI5bJKiJtMFWKuT2qZyyAMbYbJWg8ZinVtc7Byr8ls18EDQaJVJ.mSN34r2Dpb0FHFU_.0nPRFq 29QUqJuPNk8_93goLg_QkTW1P38IYRJmfqyUAs3jGrBmgzR3wiPpx2Qmzk8LTwQP41Cqt.cnxzF6 CU1Hv7yvLPNHFirGr4q8ft1SlXbwVUyb8DXNQWtEpsRSls8MvaboZs8LE41K4tix.Af1YpH9ZIGW G_6smFUz9vwuUqOGiB69aNjctGgeSovBwtWRV2yDH9 X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.bf2.yahoo.com with HTTP; Mon, 16 May 2022 15:00:42 +0000 Original-Received: by hermes--canary-production-ir2-695448f88c-qt4sn (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 0406d7034a95f7991933355fe36f6ab4; Mon, 16 May 2022 15:00:37 +0000 (UTC) Content-Disposition: inline In-Reply-To: <20220516114643.5234do3n6zbyxv7r@Ergus> X-Mailer: WebService/1.1.20188 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.134.41; envelope-from=spacibba@aol.com; helo=sonic307-2.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:289806 Archived-At: --fsysgh7gwpu5ovd7 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Hi: I just attached an extremely simple (intested) attempt to make cedet use Project.el.. Maybe Dmitry or someone with more experience may complete this and extend it when possible? Best, Ergus On Mon, May 16, 2022 at 01:46:43PM +0200, Ergus wrote: >Hi: > >Recently working in the gtags-mode package I thought to add a backend >for ede/cedet... but I have found that most of the ede features overlap >or coincide with ones in project.el. > >So my question is: Isn't it easier to add a backend in locate.el to make >ede use project as one ede-locate-setup-options? > >I am not sure about how useful is ede or cedet these days as they seem >to be a bit unmaintained, but IMHO, if we don't want to remove them (for >some reason) but still keep project.el as the preferred way to go, then >maybe cedet should use the project.el functions by default. > >The basic implementation seems to need only: > >initialize-instance >ede-locate-ok-in-project >ede-locate-file-in-project-impl >ede-locate-create/update-root-database > >Implementing all these may be extremely simple but not sure if it worth >the effort. > >What do you suggest? > >Best, >Ergus > --fsysgh7gwpu5ovd7 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="cedet.patch" diff --git a/lisp/cedet/ede/locate.el b/lisp/cedet/ede/locate.el index b9b1194ccc..67bd698b5f 100644 --- a/lisp/cedet/ede/locate.el +++ b/lisp/cedet/ede/locate.el @@ -64,8 +64,8 @@ ede-locate-setup-options (const :tag "locate" ede-locate-locate) (const :tag "GNU Global" ede-locate-global) (const :tag "ID Utils" ede-locate-idutils) - (const :tag "CScope" ede-locate-cscope))) - ) + (const :tag "CScope" ede-locate-cscope) + (const :tag "Project" ede-locate-project)))) ;;;###autoload (defun ede-enable-locate-on-project (&optional project) @@ -204,6 +204,45 @@ ede-locate-file-in-project-impl ) ) +;;; PROJECT +;; + +(declare-function project-current "project") +(declare-function project-files "project") + +(defclass ede-locate-project (ede-locate-base) + () + "EDE Locator using Project.el") + +(cl-defmethod initialize-instance ((_loc ede-locate-project) &rest _slots) + "Make sure that we can use Project API." + (cl-call-next-method) + (if-let* ((project (project-current)) + (root (project-root project))) + nil + (error "No Project.el project found for %s" default-directory))) + +(cl-defmethod ede-locate-ok-in-project ((_loc (subclass ede-locate-project)) + root) + "Is it ok to use this project type under ROOT." + (when-let ((default-directory root)) + (project-current))) + +(cl-defmethod ede-locate-file-in-project-impl + ((_loc ede-locate-project) filesubstring) + "Locate occurrences of FILESUBSTRING in LOC, using Project.el." + (mapcan (lambda (filename) + (when (string-match filesubstring filename) + filename)) + (project-files (project-current)))) + + +(cl-defmethod ede-locate-create/update-root-database + ((_loc ede-locate-project) _root) + "Create or update Project for the current project. +This is not applicable in generalized project.el." + ) + ;;; GLOBAL ;; --fsysgh7gwpu5ovd7--