emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/project 160a8cc: Expect project-search-path impls


From: Dmitry Gutov
Subject: [Emacs-diffs] scratch/project 160a8cc: Expect project-search-path impls not to include the whole project dir
Date: Thu, 09 Jul 2015 11:23:05 +0000

branch: scratch/project
commit 160a8cc37bb0a0f45ffa62a658a1d75a79757eb3
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Expect project-search-path impls not to include the whole project dir
---
 lisp/progmodes/project.el |   10 +++++++---
 lisp/progmodes/xref.el    |    6 +++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index eaa2f9a..26b32b4 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -42,7 +42,7 @@ that it is not applicable, or a project instance.")
 The directories in which we can look for the declarations or
 other references to the symbols used in the current buffer.
 Depending on the language, it should include the headers search
-path, load path, class path, or so on.
+path, load path, class path, and so on.
 
 The directory names should be absolute.  Normally set by the
 major mode.  Used in the default implementation of
@@ -61,8 +61,8 @@ The directory name should be absolute.")
 (cl-defgeneric project-search-path (project)
   "Return the list of source directories.
 Including any where source (or header, etc) files used by the
-current project may be found.  Including those outside of the
-project tree.  The directory names should be absolute.
+current project may be found, inside or outside of the project
+tree.  The directory names should be absolute.
 
 A specialized implementation should use the value
 `project-search-path-function', or, better yet, call and combine
@@ -71,6 +71,10 @@ major modes used in the project.  Alternatively, it can 
return a
 user-configurable value."
   (project--prune-directories
    (nconc (funcall project-search-path-function)
+          ;; Include these, because we don't know any better.
+          ;; But a specialized implementation may include only some of
+          ;; the project's subdirectories, if there are no source
+          ;; files at the top level.
           (project-directories project))))
 
 (cl-defgeneric project-directories (project)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index f2f02a4..2ac76e8 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -666,7 +666,11 @@ to search in."
   (interactive (list (xref--read-identifier "Find regexp: ")))
   (let* ((dirs (if current-prefix-arg
                    (list (read-directory-name "In directory: "))
-                 (project-search-path (project-current))))
+                 (let ((proj (project-current)))
+                   (project--prune-directories
+                    (nconc
+                     (project-directories proj)
+                     (project-search-path proj))))))
          (xref-find-function
           (lambda (_kind regexp)
             (cl-mapcan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]