I'm working on adding a command to the TWiki bundle that creates a new document with the raw text of an indicated TWiki URL. (I'll submit a patch once I'm happy with it.) It would be nice if my command would set the language of the new document created to "Twiki". How do I do that?
I thought perhaps I could define a macro (and add it to the bundle) that calls my command and then sets the language, but I couldn't seem to get the macro recorder to record my command (or setting the language).
-- Daryl
On 24. Apr 2007, at 19:54, Daryl Spitzer wrote:
[...] It would be nice if my command would set the language of the new document created to "Twiki". How do I do that?
This is only possible if a) the first line of the new document matches the firstLineMatch of the language grammar or b) the new document has an extension (associated to the language).
On Apr 24, 2007, at 2:13 PM, Daryl Spitzer wrote:
I'm working on adding a command to the TWiki bundle that creates a new document with the raw text of an indicated TWiki URL. (I'll submit a patch once I'm happy with it.) It would be nice if my command would set the language of the new document created to "Twiki". How do I do that?
See the MoinMoin bundle, I do exactly this. My implementation was:
Fetch Document [URL From Safari] Save: Nothing Input: None Output: Discard Command(s): require_cmd moinedit require_cmd mate mate "$(moinedit -e)"
moinedit is a relatively straight-forward shell script which uses curl to grab the document and save it to a temporary directory with an extension of .moinmoin. The path to that file is then emitted to stdout, mate opens it. The extension forces the language.
I noticed that TextMate has the nice property that if you open a new document (necessary to run a command if no document windows are open) and then select MoinMoin->Fetch Document that when the mate command runs, the frontmost (empty) document is replaced.
I also provide a template in the MoinMoin bundle but I find having to use File -> New From Template tedious.
BTW, I also stuck a stand-alone "cookie" parser in the bundle which can grab cookies from webkit, camino, or firefox (and tries in that order) which is useful for MoinMoin to grab the user's auth token.
http://macromates.com/svn/Bundles/trunk/Bundles/MoinMoin.tmbundle/
moinedit and cookie are under MoinMoin.tmbundle/Support/bin/
j.