Skip to content

Commit

Permalink
Allow the find command we use to be customized.
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Feb 17, 2010
1 parent 1679b59 commit fed13b1
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions textmate.el
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@
"The library `textmade-goto-symbol' and `textmate-goto-file' should use for
completing filenames and symbols (`ido' by default)")

(defvar textmate-find-files-command "find %s -type f"
"The command `textmate-project-root' uses to find files. %s will be replaced
the project root.")

(defvar *textmate-completing-function-alist* '((ido ido-completing-read)
(icicles icicle-completing-read)
(none completing-read))
Expand Down Expand Up @@ -299,14 +303,23 @@ Symbols matching the text at point are put first in the completion list."
(split-string
(shell-command-to-string
(concat
"find "
root
" -type f | grep -vE '"
(textmate-string-replace "%s" root textmate-find-files-command)
" | grep -vE '"
*textmate-gf-exclude*
"' | sed 's:"
*textmate-project-root*
"/::'")) "\n" t))

;; http://snipplr.com/view/18683/stringreplace/
(defun textmate-string-replace (this withthat in)
"replace THIS with WITHTHAT' in the string IN"
(with-temp-buffer
(insert in)
(goto-char (point-min))
(while (search-forward this nil t)
(replace-match withthat nil t))
(buffer-substring (point-min) (point-max))))

(defun textmate-cached-project-files (&optional root)
"Finds and caches all files in a given project."
(cond
Expand Down

0 comments on commit fed13b1

Please sign in to comment.