Hi,
I've updated my Search in Project with ack command. The new version is here:
http://www.simplicidade.org/notes/archives/2008/03/search_in_proje.html
Thanks to Daniel Hüsch for poiting out the 404 in the page.
Best regards,
On Mon, May 26, 2008 at 1:49 PM, Pedro Melo melo@simplicidade.org wrote:
I've updated my Search in Project with ack command. The new version is here:
http://www.simplicidade.org/notes/archives/2008/03/search_in_proje.html
Is there a way to have the command available with no file open?
On 26 May 2008, at 15:29, Xavier Noria wrote:
On Mon, May 26, 2008 at 1:49 PM, Pedro Melo melo@simplicidade.org wrote:
I've updated my Search in Project with ack command. The new version is here:
http://www.simplicidade.org/notes/archives/2008/03/search_in_proje.html
Is there a way to have the command available with no file open?
Actually no. At least one file must be open in order to execute a bundle command. But maybe the command can be written as a Template. Then it would be possible, I guess. I did this for some of my commands, and it works.
--Hans
I've updated my Search in Project with ack command.
I've been unable to get this working on Leopard with cutting edge TM, SVN updated Support, and freshly copied standalone version of ack 1.84 chmodded +x and placed in ~/bin, which is the first entry on my $PATH. I even tested it with a symlinked version at /usr/local/bin, but no dice.
I installed it via double-click from the Safari downloads window, but subsequently attempted to uninstall and reinstall via double-click from the Finder (which only then elicited the "already installed..." confirmation).
Looking at the script, there is not secret "TM_*" variable in play, any other suggestions? There are no conflicting keyboard shortcuts, because I can get the window to show every time, even with the currently searched for string, but absolutely no other result than "No results".
I can stare at a document full of <table> elements, invoke the command, type "table", and still no results (I always have the project root folder selected and the drawer itself closed, for use with Git/ SVN bundles). Yet when I type `ack table` on the command line (at the project root), I get thousands of results. No errors in the Console that I can see, and no errors output into the results window.
Thanks, Daniel
Hi,
On May 27, 2008, at 7:09 PM, Daniel Stockman wrote:
I've updated my Search in Project with ack command.
I've been unable to get this working on Leopard with cutting edge TM, SVN updated Support, and freshly copied standalone version of ack 1.84 chmodded +x and placed in ~/bin, which is the first entry on my $PATH. I even tested it with a symlinked version at /usr/ local/bin, but no dice.
I don't use Leopard yet, and my TextMate-fu is extremelly limited. I basically copied the Search in Project With Grep tmcommand and ajusted the parts that made sense.
Do you get any error? Sometimes the header of the HTML window gets in the way of the error messages. When that happens I temporarly switch the Output of the command from Show as HTML to Create a New Document. The error messages would be at the top of the new document.
But as long as the ack command is your shell PATH, it should work.
Looking at the script, there is not secret "TM_*" variable in play, any other suggestions? There are no conflicting keyboard shortcuts, because I can get the window to show every time, even with the currently searched for string, but absolutely no other result than "No results".
Try the trick above: switch the Output to Create a New Document and do your search again to see if any error messages show up.
Best regards,
On May 27, 2008, at 11:09 , Daniel Stockman wrote:
I've updated my Search in Project with ack command.
I've been unable to get this working on Leopard with cutting edge TM, SVN updated Support, and freshly copied standalone version of ack 1.84 chmodded +x and placed in ~/bin, which is the first entry on my $PATH. I even tested it with a symlinked version at /usr/local/ bin, but no dice.
TextMate doesn't inherit your PATH. See: http://manual.macromates.com/en/shell_commands#search_path
I'm was having the same problem as you -- running 10.5.2, ack installed in ~/.bin (which is in my PATH), and no results.
In the Bundle Editor I tweaked Pedro's script to hardcode the path to ack. It started working. After some googling I found the TM manual reference above and will give the fixes mentioned there a try.
Corey
I tweaked Pedro's tmCommand a bit (diff below) to add support for searching files/folders selected in the project drawer. The drawback to this is that it now only searches the selected files/folders. If you want to search the whole project with this version you must select the project folder before doing the search.
I'm sure I've overlooked some edge case. This change was simple enough I'm surprised the original GrepInProject didn't support it so I must be overlooking something.
Corey
--- Search in Project with ack.tmCommand.pedro 2008-05-30 11:52:43.000000000 -0700 +++ Search in Project with ack.tmCommand 2008-05-30 11:52:23.000000000 -0700 @@ -119,8 +119,11 @@ <table> HTML
-# TODO: Respect ENV['TM_SELECTED_FILES'] -command = %{cd "#{directory}"; ack #{e_sh query}} +if ENV['TM_SELECTED_FILES'] + command = %{ack -H #{e_sh query} #{ENV['TM_SELECTED_FILES']}} +else + command = %{cd "#{directory}"; ack #{e_sh query}} +end
IO.popen(command) do |pipe|
@@ -133,7 +136,10 @@ line.gsub!(/^([^:]+):(\d+):(.*)$/) do
relative_path, line_number, content = $1, $2, $3.strip - path = directory + '/' + relative_path + + relative_path.sub!(directory + "/", '') if ENV['TM_SELECTED_FILES'] + + path = directory + '/' + relative_path url = "txmt://open/?url=file://#{path}&line=#{line_number}" fname = "%s:%s" % [ellipsize_path(relative_path), line_number]; fname = ":%s" % [ line_number ] if (path == last_path);
On May 26, 2008, at 04:49 , Pedro Melo wrote:
Hi,
I've updated my Search in Project with ack command. The new version is here:
http://www.simplicidade.org/notes/archives/2008/03/ search_in_proje.html
Thanks to Daniel Hüsch for poiting out the 404 in the page.
Best regards,
Pedro Melo Blog: http://www.simplicidade.org/notes/ XMPP ID: melo@simplicidade.org Use XMPP!
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On May 29, 2008, at 10:01 PM, Corey Jewett wrote:
TextMate doesn't inherit your PATH. See: http://manual.macromates.com/en/shell_commands#search_path
I'm was having the same problem as you -- running 10.5.2, ack installed in ~/.bin (which is in my PATH), and no results.
I wonder if you can hear palms smacking foreheads through a mailing list. :D
Thanks!
~ Daniel
Hi,
On May 30, 2008, at 8:01 PM, Corey Jewett wrote:
I tweaked Pedro's tmCommand a bit (diff below) to add support for searching files/folders selected in the project drawer. The drawback to this is that it now only searches the selected files/ folders. If you want to search the whole project with this version you must select the project folder before doing the search.
Yes, or de-select the file. But it is a welcome improvement, so I've updated my copy with it.
I've also moved the code to GitHub. See http://github.com/melo/search- in-project-with-ack-tmcommand
The latest version will always be there now. No more 404's :)
I'm sure I've overlooked some edge case. This change was simple enough I'm surprised the original GrepInProject didn't support it so I must be overlooking something.
So far I didn't notice any edge cases.
Best regards,
Corey
--- Search in Project with ack.tmCommand.pedro 2008-05-30 11:52:43.000000000 -0700 +++ Search in Project with ack.tmCommand 2008-05-30 11:52:23.000000000 -0700 @@ -119,8 +119,11 @@ <table> HTML
-# TODO: Respect ENV['TM_SELECTED_FILES'] -command = %{cd "#{directory}"; ack #{e_sh query}} +if ENV['TM_SELECTED_FILES']
- command = %{ack -H #{e_sh query} #{ENV['TM_SELECTED_FILES']}}
+else
- command = %{cd "#{directory}"; ack #{e_sh query}}
+end
IO.popen(command) do |pipe|
@@ -133,7 +136,10 @@ line.gsub!(/^([^:]+):(\d+):(.*)$/) do
relative_path, line_number, content = $1, $2, $3.strip
path = directory + '/' + relative_path
relative_path.sub!(directory + "/", '') if ENV
['TM_SELECTED_FILES']
path = directory + '/' + relative_path url = "txmt://open/?url=file://#{path}&line=#{line_number}" fname = "%s:%s" % [ellipsize_path(relative_path), line_number]; fname = ":%s" % [ line_number ] if (path == last_path);
On May 26, 2008, at 04:49 , Pedro Melo wrote:
Hi,
I've updated my Search in Project with ack command. The new version is here:
http://www.simplicidade.org/notes/archives/2008/03/ search_in_proje.html
Thanks to Daniel Hüsch for poiting out the 404 in the page.
Best regards,
Pedro Melo Blog: http://www.simplicidade.org/notes/ XMPP ID: melo@simplicidade.org Use XMPP!
_ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On May 27, 2008, at 7:09 PM, Daniel Stockman wrote:
I've updated my Search in Project with ack command.
I've been unable to get this working on Leopard with cutting edge TM, SVN updated Support, and freshly copied standalone version of ack 1.84 chmodded +x and placed in ~/bin, which is the first entry on my $PATH. I even tested it with a symlinked version at /usr/ local/bin, but no dice.
I've updated the code (see http://github.com/melo/search-in-project- with-ack-tmcommand for the latest version) to allow you to set TM_ACK_COMMAND_PATH to the full path of the ack command.
I'm not a ruby programmer, but if someone can point me to the docs on how to catch errors of the popen call (http://github.com/melo/search- in-project-with-ack-tmcommand/tree/master/Search%20in%20Project%20with %20ack.tmCommand#L143) I'll include it.
There is an open TODO on this (http://github.com/melo/search-in- project-with-ack-tmcommand/tree/master/Search%20in%20Project%20with% 20ack.tmCommand#L203-204)
Looking at the script, there is not secret "TM_*" variable in play, any other suggestions? There are no conflicting keyboard shortcuts, because I can get the window to show every time, even with the currently searched for string, but absolutely no other result than "No results".
Added, see above.
Best regards,
On 02/06/2008, at 8:20 PM, Pedro Melo wrote:
I'm not a ruby programmer, but if someone can point me to the docs on how to catch errors of the popen call (http://github.com/melo/search-in-project-with-ack-tmcommand/tree/master/Sear... ) I'll include it.
http://ldaley.com/tmp/Search%20in%20Project%20with%20ack.tmDelta
Basically did three things:
• Used TextMate.require_cmd to make sure ack is available.
• Used TextMate::Process.run() to open ack is it separates STDOUT from STDERR and is slightly more convenient to use than popen3
• Throw an alert if ack returns a non zero status code.
Thanks for the command!
LD.
Hi,
On Jun 2, 2008, at 11:57 PM, Luke Daley wrote:
On 02/06/2008, at 8:20 PM, Pedro Melo wrote:
I'm not a ruby programmer, but if someone can point me to the docs on how to catch errors of the popen call (http://github.com/melo/ search-in-project-with-ack-tmcommand/tree/master/Search%20in% 20Project%20with%20ack.tmCommand#L143) I'll include it.
http://ldaley.com/tmp/Search%20in%20Project%20with%20ack.tmDelta
Basically did three things:
• Used TextMate.require_cmd to make sure ack is available.
• Used TextMate::Process.run() to open ack is it separates STDOUT from STDERR and is slightly more convenient to use than popen3
• Throw an alert if ack returns a non zero status code.
http://github.com/melo/search-in-project-with-ack-tmcommand/commit/ dbb9155b61ad62f09c0e92b8ee110d5aedb74c1b
Latest version at http://github.com/melo/search-in-project-with-ack- tmcommand/tree/master%2FSearchInProjectWithAck.tmCommand?raw=true
Best regards,