From: Ergus <spacibba@aol.com>
To: emacs-devel@gnu.org
Cc: Dmitry Gutov <dgutov@yandex.ru>
Subject: Re: Should EDE use project.el [PATCH]
Date: Mon, 16 May 2022 17:00:35 +0200 [thread overview]
Message-ID: <20220516150035.f5yryr6uby6msfqy@Ergus> (raw)
In-Reply-To: <20220516114643.5234do3n6zbyxv7r@Ergus>
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]
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
>
[-- Attachment #2: cedet.patch --]
[-- Type: text/plain, Size: 1947 bytes --]
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
;;
next prev parent reply other threads:[~2022-05-16 15:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220516114643.5234do3n6zbyxv7r.ref@Ergus>
2022-05-16 11:46 ` Should EDE use project.el Ergus
2022-05-16 15:00 ` Ergus [this message]
2022-05-16 15:50 ` Should EDE use project.el [PATCH] Dmitry Gutov
2022-05-16 16:09 ` Ergus
2022-05-16 17:15 ` Eli Zaretskii
2022-05-16 19:40 ` andres.ramirez
2022-05-16 16:23 ` Ergus
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220516150035.f5yryr6uby6msfqy@Ergus \
--to=spacibba@aol.com \
--cc=dgutov@yandex.ru \
--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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).