[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-sig-mac
Subject:    Re: [R-SIG-Mac] project request: TextWrangler plugin
From:       Jean Thioulouse <jtnews1 () biomserv ! univ-lyon1 ! fr>
Date:       2008-11-10 12:09:52
Message-ID: p06240801c53dce0ca603 () [134 ! 214 ! 32 ! 97]
[Download RAW message or body]

At 18:07 -0500 8/11/08, Carl Witthoft wrote:
>I know :-), I should just learn AquaMacs w/ ESS,  but I am 
>comfortable w/ TextWrangler.  So, just thought I'd put a shout out 
>to see if anyone would like to write a plugin that would let the 
>user execute code (in R.app) from a TextWrangler window.

Here is a small script that does the job. You can put it in Textwrangler
Scripts folder and assign it a key (like Cmd-R) in the Scripts palette.
Of course you need a working R.app but then it is very handy. You can
get the source file here: http://pbil.univ-lyon1.fr/JTHome/SendSelToR.txt

--
-- This script can be used to make TextWrangler execute commands in R.
-- It executes the current selection. If no text is selected it executes the current line.
-- Jean Thioulouse - Nov. 2008 - Jean.Thioulouse@univ-lyon1.fr
--
tell application "TextWrangler"
  set the_selection to (selection of front window as string)
  if (the_selection) is "" then
    set the_selection to line (get startLine of selection) of front window as string
  end if
end tell
tell application "R"
  cmd the_selection
end tell

-- 
Jean Thioulouse - Labo Biometrie et Biologie Evolutive,  UMR CNRS 5558
Universite Lyon 1, Batiment Mendel,   43 Boulevard du 11 Novembre 1918
                  69622 Villeurbanne Cedex - France                   
Tel : (33) (0)4 72 43 27 56                Fax : (33) (0)4 72 43 13 88
http://pbil.univ-lyon1.fr/JTHome/    http://www.sauvonslarecherche.fr/

_______________________________________________
R-SIG-Mac mailing list
R-SIG-Mac@stat.math.ethz.ch
https://stat.ethz.ch/mailman/listinfo/r-sig-mac
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic