Open Synapse

Hi, I'm Abhay Kumar. I like to throw up interesting things I encounter here. You can also see the result of my mustache pact with my coworkers, check out what I'm up to or see the few photos I take. I like to receive email and instant messages (AIM / Jabber), as well. Some links of interest: Calais Text Tagger, Powerset

Feb 14
Permalink

&*#%! I Made Grep in Project slow... and then I fixed it

Henrik Nyh’s Grep in Project is awesome, so awesome that I think it should replace Textmate’s existing Find in Project. Today I tried it out on a project with a reasonably sized ferret index and, even though it balked a bit, I did actually get a response.

Since I don’t really care about any results in the ferret folders, I decided to patch the command a bit:  

 --- Grep in Project.tmCommand
+++ (clipboard)
@@ -111,7 +111,7 @@
HTML

# TODO: Respect ENV['TM_SELECTED_FILES']
-command = %{cd "#{directory}"; find . \\( -path '*/.svn' -or -path '*/vendor/rails' \\) -prune -or -type f -print0 | xargs -0 grep -nr --ignore-case --fixed-strings --exclude='*.log' #{e_sh query}}
+command = %{cd "#{directory}"; find . \\( -path '*.ferret' -or -path '*/.svn' -or -path '*/vendor/rails' \\) -prune -or -type f -print0 | xargs -0 grep -nr --ignore-case --fixed-strings --exclude='*.log' #{e_sh query}}

IO.popen(command) do |pipe|

Now Grep in Project is as fast as before, yay. 

P.S. Notice how it already ignores vendor/rails and .svn folders? Well done, Henrik.

Comments (View)
blog comments powered by Disqus

Change CongressVote Obama