Skip to content

Commit

Permalink
Changes find command to output paths relative to project root
Browse files Browse the repository at this point in the history
Why? If you're in a project-folder that would be otherwise excluded by
*textmate-gf-exclude*, then textmate-goto-file is rendered
non-functional because EVERY file will ignored.  By making find output
relative paths, the ignore regular expression will only operate on files
and directories within the project.

Additionally, `format' will escape double-quotes for us if we use it and
use %S as the placeholder.  This eliminates an unnecessary dependency on
textmate-string-replace.
  • Loading branch information
timcharper committed Aug 26, 2010
1 parent d11765c commit 6937396
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions textmate.el
Expand Up @@ -81,9 +81,9 @@
"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-find-files-command "(cd %S && find . -type f)"
"The command `textmate-project-root' uses to find files. %S will be replaced
the project root and will be surrounded by double-quotes.")

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

;; http://snipplr.com/view/18683/stringreplace/
(defun textmate-string-replace (this withthat in)
Expand Down

0 comments on commit 6937396

Please sign in to comment.