Added caching to find-file-in-project.

This commit is contained in:
Ivan Malison 2013-04-11 10:40:05 -07:00
parent 7cec3f8db3
commit 767b5c276e
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) root (ffip-join-patterns)
ffip-find-options ffip-limit)))))) 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 ;;;###autoload
(defun find-file-in-project () (defun find-file-in-project ()
"Prompt with a completing list of all files in the project to find one. "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 an `.emacs-project' file. You can override this by locally
setting the variable `ffip-project-root'." setting the variable `ffip-project-root'."
(interactive) (interactive)
(let* ((project-files (ffip-project-files)) (let* ((project-files (ffip-get-project-files))
(files (mapcar 'car project-files)) (files (mapcar 'car project-files))
(file (if (and (boundp 'ido-mode) ido-mode) (file (if (and (boundp 'ido-mode) ido-mode)
(ido-completing-read "Find file in project: " files) (ido-completing-read "Find file in project: " files)

View File

@ -58,6 +58,9 @@
;; Disable the menu bar. ;; Disable the menu bar.
(menu-bar-mode -1) (menu-bar-mode -1)
;; find-file-in-project
(setq ffip-limit 9999999999)
;; ============================================================================= ;; =============================================================================
;; tmux ;; tmux
;; ============================================================================= ;; =============================================================================