[TxMt] Bundle for Stata

xolela at mac.com xolela at mac.com
Fri Sep 1 07:52:38 UTC 2006


Tim,

I think the temporary file approach (for dealing with selections)   
might be the one that works with stata..  It  seems that AlphaX uses  
the same approach via tcl.


Here is the do selection part from the alphaX stata mode with the tcl  
code if it is of any help (or if any of the textmate users  that  
understand both can help with ):


#  
======================================================================== 
===
#
# Do Selection
#
# Procedure to implement transfer of selected lines to Stata for  
processing.
#

proc Stta::doSelection {{selection ""} {app "Stata"}} {

     global SttamodeVars

     if {$selection == ""} {
         if {![isSelection]} {
             status::msg "No selection -- cancelled."
             return
         } else {
             set selection [getSelect]
         }
     }
     set tempDir [temp::directory Stata]
     set newFile [file join $tempDir temp-Stata.do]
     file::writeAll $newFile $selection 1

     app::launchBack '$SttamodeVars(stataSig)'
     sendOpenEvent noReply '$SttamodeVars(stataSig)' $newFile
     switchTo '$SttamodeVars(stataSig)'
}

proc Stta::quitHook {} {temp::cleanup Stata}

#  
======================================================================== 
===


We could use the temprory file workaround as we figure out an elegant  
textmate-centric  solution.

danstan









On Sep 1, 2006, at 3:06 AM, Timothy Beatty wrote:

> Thanks for the feedback,
>
> Danstan,
>
> The only way I've been able to figure out to run selections is to save
> the selection to a temporary file and run the temporary file.  Alan
> suggested saving the file in /temp/somthing.do, rather than in the
> current working directory.  I think that makes sense and will give it
> a bid.  I looked at the R bundle's implementation of running a
> selection, and as best I could tell (not very well, granted) it relies
> on some AppleScript that Stata doesn't recognize.  Simply stealing the
> R implementation was my first instinct, but I couldn't get it to work
> (which doesn't mean, it can't work, just that I couldn't get it to
> work).
>
> Alan,
>
> Thanks for the suggestions, I think I'll probably use both of them,
>
> Tim
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list