summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/progmodes/project.el10
-rw-r--r--lisp/progmodes/xref.el6
2 files changed, 12 insertions, 4 deletions
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index eaa2f9aa405..26b32b4b750 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 f2f02a41367..2ac76e8a263 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