From 7dc851b627d79e59e8c7d4317dff63bfe03f9367 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 10 Apr 2013 17:40:07 -0700 Subject: [PATCH] editors.textwrangler: Fall back to launching with open -a if you installed from the Mac Store and thus do not have ``edit``, which is the real TextWrangler launch program. --- .../editors/textwrangler/textwrangler.factor | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/basis/editors/textwrangler/textwrangler.factor b/basis/editors/textwrangler/textwrangler.factor index b8ac04a303..1f645298d7 100644 --- a/basis/editors/textwrangler/textwrangler.factor +++ b/basis/editors/textwrangler/textwrangler.factor @@ -1,11 +1,25 @@ ! Copyright (C) 2008 Ben Schlingelhof. ! See http://factorcode.org/license.txt for BSD license. -USING: definitions io.launcher kernel parser words sequences -math math.parser namespaces editors make ; +USING: editors kernel make math.parser namespaces sequences +tools.which ; IN: editors.textwrangler +! TextWrangler ships with a program called ``edit`` if you don't download +! it from the App Store. Since the App Store version is lacking ``edit``, +! there's a separate .zip you can download from: +! http://pine.barebones.com/files/tw-cmdline-tools.zip + +! Note that launching with ``open -a`` does not support line numbers. + SINGLETON: textwrangler textwrangler editor-class set-global M: textwrangler editor-command ( file line -- command ) - [ "edit +" % # " " % % ] "" make ; + "edit" which [ + [ "edit +" % # " " % % ] "" make + ] [ + [ + "open" , "-a" , "TextWrangler" , + [ , ] [ "--args" , number>string "+" prepend , ] bi* + ] { } make + ] if ;