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