[TxMt] Can a command set the language for a new document?
Jay Soffian
jay-txmt at soffian.org
Thu Apr 26 15:13:27 UTC 2007
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.
More information about the textmate
mailing list