sábado, 16 de julio de 2011

open rails files from console to $EDITOR

You're in the console, run rake test, and appear a bunch of file paths cluttered with line numbers, colons, and no spaces between them. Well, lest turn the no-space-between them thing in a WIN for us.

Errors and failures show in different formats when running tests (not a very *intelligent* thing if you ask me, but...). Well, a simple regex and we have 'pe' , powered-emacslient, path-edit, or whatever. In my shell, double click any of the two versions and 'pe ', and you're sitting again on your editor. placed in the correct line.

.. app/models/bar.rb:88:in ..
.. [test/unit/foo_test.rb:9]: ..

'e' is the original emacsclient script I use for other files. Unifying both scripts in one is left as exercise to the reader.

I want to spend an afternoon hacking a urxvt plugin to fetch for strings ressembling paths, and be able to open them using just keyboard, but that's a thing for another day.