[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/project-files-pipe-grep f6b91ec: Make project-file
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] scratch/project-files-pipe-grep f6b91ec: Make project-files the "canonical" one |
Date: |
Sat, 5 Jan 2019 20:17:23 -0500 (EST) |
branch: scratch/project-files-pipe-grep
commit f6b91ec9d91b8f37471aaf5a1a72a942585aba76
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Make project-files the "canonical" one
---
lisp/progmodes/project.el | 41 ++++++++++++++++++-----------------------
1 file changed, 18 insertions(+), 23 deletions(-)
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 3ed1cea..8936f5a 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -162,23 +162,10 @@ end it with `/'. DIR must be one of `project-roots' or
DIRS is a list of absolute directories; it should be some
subset of the project roots and external roots.
-The default implementation uses `find-program'. PROJECT is used
-to find the list of ignores for each directory."
+The default implementation delegates to `project-files'."
;; FIXME: Uniquely abbreviate the roots?
(require 'xref)
- (let ((all-files
- (cl-mapcan
- (lambda (dir)
- (let ((command
- (format "%s %s %s -type f -print0"
- find-program
- (shell-quote-argument
- (expand-file-name dir))
- (xref--find-ignores-arguments
- (project-ignores project dir)
- (expand-file-name dir)))))
- (split-string (shell-command-to-string command) "\0" t)))
- dirs)))
+ (let ((all-files (project-files project dirs)))
(lambda (string pred action)
(cond
((eq action 'metadata)
@@ -192,14 +179,22 @@ to find the list of ignores for each directory."
(cl-defgeneric project-files (project &optional dirs)
"Return a list of files in directories DIRS in PROJECT.
DIRS is a list of absolute directories; it should be some
-subset of the project roots and external roots."
- ;; This default implementation only works if project-file-completion-table
- ;; returns a "flat" completion table.
- ;; FIXME: Maybe we should do the reverse: implement the default
- ;; `project-file-completion-table' on top of `project-files'.
- (all-completions
- "" (project-file-completion-table
- project (or dirs (project-roots project)))))
+subset of the project roots and external roots.
+
+The default implementation uses `find-program'. PROJECT is used
+to find the list of ignores for each directory."
+ (cl-mapcan
+ (lambda (dir)
+ (let ((command
+ (format "%s %s %s -type f -print0"
+ find-program
+ (shell-quote-argument
+ (expand-file-name dir))
+ (xref--find-ignores-arguments
+ (project-ignores project dir)
+ (expand-file-name dir)))))
+ (split-string (shell-command-to-string command) "\0" t)))
+ (or dirs (project-roots project))))
(defgroup project-vc nil
"Project implementation using the VC package."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] scratch/project-files-pipe-grep f6b91ec: Make project-files the "canonical" one,
Dmitry Gutov <=