Added caching to find-file-in-project.

This commit is contained in:
2013-04-11 10:40:05 -07:00
parent 903ab9e2d7
commit a74a7c7ef7
2 changed files with 11 additions and 1 deletions

View File

@@ -139,6 +139,13 @@ directory they are found in so that they are unique."
root (ffip-join-patterns)
ffip-find-options ffip-limit))))))
(defvar ffip-project-files-cache '())
(defun ffip-get-project-files ()
(when (equal (assoc (ffip-project-root) ffip-project-files-cache) nil)
(add-to-list 'ffip-project-files-cache `(,(ffip-project-root) ,(ffip-project-files))))
(car (cdr (assoc (ffip-project-root) ffip-project-files-cache))))
;;;###autoload
(defun find-file-in-project ()
"Prompt with a completing list of all files in the project to find one.
@@ -147,7 +154,7 @@ The project's scope is defined as the first directory containing
an `.emacs-project' file. You can override this by locally
setting the variable `ffip-project-root'."
(interactive)
(let* ((project-files (ffip-project-files))
(let* ((project-files (ffip-get-project-files))
(files (mapcar 'car project-files))
(file (if (and (boundp 'ido-mode) ido-mode)
(ido-completing-read "Find file in project: " files)