[TxMt] Clean Macros

Marshall Beddoe mbeddoe at gmail.com
Thu Oct 12 21:25:54 UTC 2006


Hello,

   Forgive me if this question has been asked, I searched but found  
no answer.  I am working on a bundle that is a subset of the ruby  
bundle and I would like to have some macros similar to the ones in  
the ruby bundle, namely the macros that automatically insert the  
requires.  Looking at the macros in the ruby bundle, they are very  
clean:
   - moveToBeginningOfDocumentAndModifySelection:
   - executeCommandWithOptions:
      {
         command = "insert_requires.rb yaml";
         input = selection;
         output = insertAsSnippet;
     }
   - insertSnippetWithOptions
      etc.

Since, there is no real bundle editor, I am trying to replicate this  
process for macros under my bundle.  If I were to get to the step of  
executing the command, I hit the key equivalent for this  
insert_requires.rb command, but instead of getting a clean looking  
macro recording like the one above, I get one who's command is filled  
with the exact ruby source code being executed:

{
     beforeRunningCommand = nop;
     command = "#!/usr/bin/env ruby\n$: << \"#{ENV 
['TM_SUPPORT_PATH']}/lib\"\n\nrequire \"escape\"\nrequire \"open3\"\n 
\nCURSOR = [0xFFFC].pack(\"U\").freeze\nline, col = ENV 
[\"TM_LINE_NUMBER\"].to_i - 1, ENV[\"TM_LINE_INDEX\"].to_i\n\nstdin,  
stdout, stderr = Open3.popen3(\"/usr/bin/env\", \"ruby\", \"#{ENV 
['TM_BUNDLE_SUPPORT']}/bin/insert_requires.rb\")\nThread.new do\n   
code = STDIN.read.to_a\n  code[line][col...col] = CURSOR unless  
ENV.has_key?('TM_SELECTED_TEXT')\n  stdin.write code.join\n   
stdin.close\nend\n\nprint stdout.read.split(CURSOR).join('${0}')\n";
     fallbackInput = document;
     input = selection;
     keyEquivalent = "^#";
     name = "Insert Missing Requires";
     output = insertAsSnippet;
     scope = "source.ruby";
     uuid = "9FB64639-F776-499B-BA6F-BB45F86F80FD";
}

Can someone please let me know what I am doing wrong here?  Do I have  
to hand hack the plist file or what?

Thanks in Advance,
Marshall



More information about the textmate mailing list