<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -15,6 +15,11 @@
 # Updated to use with ack by Pedro Melo &amp;lt;melo@simplicidade.org&amp;gt; 2008-05-26
 # Support for TM_SELECTED_FILES by Corey Jewett &amp;lt;ml@syntheticplayground.com&amp;gt; 2008-05-30
 #
+# 2008-08-11 (melo): Added flag &amp;apos;:&amp;apos; you must start your query with a : to
+# search only in the &amp;quot;selected files&amp;quot;. I added this because using the
+# selected files ends up not being something that I commonly do.
+#
+#
 # **NOTE WELL**: TextMate does not inherit your PATH, so if you this
 # command does not find it define the environment variable
 # TM_ACK_COMMAND_PATH in your Preferences &amp;gt; Advanced &amp;gt; Shell Variables with
@@ -121,18 +126,28 @@ bail(&amp;quot;Not in a saved file&amp;quot;) unless directory
 
 query = TextMate::UI.request_string(:title =&amp;gt; &amp;quot;Search in Project with ack&amp;quot;, :prompt =&amp;gt; &amp;quot;Find this:&amp;quot;, :default =&amp;gt; %x{pbpaste -pboard find})
 bail(&amp;quot;Search aborted&amp;quot;) unless query
+
+if query[0,1] == &amp;apos;:&amp;apos;
+  query[0,1] = &amp;apos;&amp;apos;
+  use_selected_files = true
+else
+  use_selected_files = false
+end
+
 IO.popen(&amp;apos;pbcopy -pboard find&amp;apos;, &amp;apos;w&amp;apos;) { |copy| copy.print query }
 
 puts &amp;lt;&amp;lt;-HTML
   &amp;lt;h2&amp;gt;Searching for #{ escape(query) }&amp;lt;/h2&amp;gt;
 HTML
 
-selected_files=TextMate.selected_files
+if use_selected_files
+  selected_files=TextMate.selected_files
+end
 
 if selected_files
 	command = [ack_cmd, &amp;quot;-H&amp;quot;, &amp;apos;--&amp;apos;, query, selected_files]
 	puts &amp;lt;&amp;lt;-HTML
-	  &amp;lt;p&amp;gt;&amp;lt;small&amp;gt;Search limited to  #{ escape(selected_files.join(&amp;apos; &amp;apos;)) }&amp;lt;/small&amp;gt;&amp;lt;/p&amp;gt;
+	  &amp;lt;p&amp;gt;&amp;lt;small&amp;gt;Search limited to #{ escape(selected_files.join(&amp;apos; &amp;apos;)) }&amp;lt;/small&amp;gt;&amp;lt;/p&amp;gt;
 HTML
 else
 	Dir.chdir(directory)</diff>
      <filename>SearchInProjectWithAck.tmCommand</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,11 @@
 # Updated to use with ack by Pedro Melo &lt;melo@simplicidade.org&gt; 2008-05-26
 # Support for TM_SELECTED_FILES by Corey Jewett &lt;ml@syntheticplayground.com&gt; 2008-05-30
 #
+# 2008-08-11 (melo): Added flag ':' you must start your query with a : to
+# search only in the &quot;selected files&quot;. I added this because using the
+# selected files ends up not being something that I commonly do.
+#
+#
 # **NOTE WELL**: TextMate does not inherit your PATH, so if you this
 # command does not find it define the environment variable
 # TM_ACK_COMMAND_PATH in your Preferences &gt; Advanced &gt; Shell Variables with
@@ -112,13 +117,23 @@ bail(&quot;Not in a saved file&quot;) unless directory
 
 query = TextMate::UI.request_string(:title =&gt; &quot;Search in Project with ack&quot;, :prompt =&gt; &quot;Find this:&quot;, :default =&gt; %x{pbpaste -pboard find})
 bail(&quot;Search aborted&quot;) unless query
+
+if query[0,1] == ':'
+  query[0,1] = ''
+  use_selected_files = true
+else
+  use_selected_files = false
+end
+
 IO.popen('pbcopy -pboard find', 'w') { |copy| copy.print query }
 
 puts &lt;&lt;-HTML
   &lt;h2&gt;Searching for #{ escape(query) }&lt;/h2&gt;
 HTML
 
-selected_files=TextMate.selected_files
+if use_selected_files
+  selected_files=TextMate.selected_files
+end
 
 if selected_files
 	command = [ack_cmd, &quot;-H&quot;, '--', query, selected_files]</diff>
      <filename>search_with_ack.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>6abdeb4e31c5e4837fd8f8529e0df310e2c27154</id>
    </parent>
  </parents>
  <author>
    <name>Pedro Melo</name>
    <email>melo@simplicidade.org</email>
  </author>
  <url>http://github.com/melo/search-in-project-with-ack-tmcommand/commit/a598b52aad56c1d07414d013174b2fa9e4b0324d</url>
  <id>a598b52aad56c1d07414d013174b2fa9e4b0324d</id>
  <committed-date>2008-08-11T05:30:23-07:00</committed-date>
  <authored-date>2008-08-11T05:30:23-07:00</authored-date>
  <message>Make search in selected files opt-in

By default we search everywhere now. To search only on the selected files,
start your query with a ':' (a single colon sign).

The colon sign will be removed from the query but will enable the selected
files filter.

I did this because I prefer the default to be search everywhere.
I rarely use the &quot;search in selected files&quot; feature.

Signed-off-by: Pedro Melo &lt;melo@simplicidade.org&gt;</message>
  <tree>af87f0aef1703c1d899c3581ddac15d1a98bf4fa</tree>
  <committer>
    <name>Pedro Melo</name>
    <email>melo@simplicidade.org</email>
  </committer>
</commit>
