We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Processing & TextMate (mac) - get it work !
Page Index Toggle Pages: 1
Processing & TextMate (mac) - get it work ! (Read 1517 times)
Processing & TextMate (mac) - get it work !
Sep 30th, 2008, 11:20pm
 
Hello !

I've discovered TextMate some time ago, it really seems to be the ultimate text editor. Processing beeing the ultimate graphic programming framework, it is logical to try to make them work together as good as possible.

Here's what I found to :
a) import a Processing bundle into TextMate (which enhances code coloration and more)
b) make the "run" command available directly from within TextMate
c) make the "find in reference" command also available.

If you know some other integration tips, or if the one I wrote need modifications, I'll edit my post.

Thanks


*********************

A1 - get the "getBundle" bundle (which allows to easily install new bundles) here :
http://www.mediafire.com/?sharekey=1fe449c934f20050986eca91a54c91a79718333b36fcdcf0
and install it just by double clicking it.

A2 - open TextMate, in go to menu>Bundles>GetBundles>Install Bundle and in the dialog box, find "Processing". It should install everything by itself !

*********************

The problem is that the run command does not work, so you have to :

B0 - in processing's preferences, check the "use external editor" box.

B1 - go to menu>Bundles>Bundle Editor>Show Bundle Editor

B2 - unfold processing, and select “© Run in Processing"

B3 - set save to "All files in project" and the big text box to (without the lines):
---------
open -a Processing\ 0135 ${TM_FILEPATH}
osascript <<-APPLESCRIPT
tell application "Processing 0135" to activate
tell application "System Events" to tell process "Processing"
delay 0.3
keystroke "r" using command down
end tell
APPLESCRIPT
---------

Do not forget to change "0135" to the actual version number you are using.

B4 - eventually modify the shortcut (cmd-r by default).

You should now be able to hit cmd-r and have the code being executed in Processing.

*********************

You now want to have direct acces to the reference.

C1 - in TextMate's preferences>Advanced>Shell variable, add a new variable

C2 - name it "TM_PROCESSING_DOC" and set the value to the path to your documentation (in my case : "/Applications/Processing 0135/reference/" )

C3 - back to menu>Bundles>Bundle Editor>Show Bundle Editor, add a new command to Processing's bundle.

C4 - Put that in the big text box (without the lines):
---------
#!/usr/bin/python
import os
import webbrowser
from os import path

### DEFINITIONS
def viewdoc(filename):
 if path.exists(filename + "_.html") and path.isfile(filename + "_.html"):
   webbrowser.open(filename + "_.html")
 elif path.exists(filename + ".html") and path.isfile(filename + ".html"):
   webbrowser.open(filename + ".html")
 else:
   print "Word not found or TM_PROCESSING_DOC not set properly."


### BEGIN SCRIPT
reference = os.environ['TM_PROCESSING_DOC']
word = os.environ['TM_CURRENT_WORD']

if reference.endswith("/"):
 pass
else:
 reference = os.environ['TM_PROCESSING_DOC'] + "/"

viewdoc(reference + word)
---------

C5 - Set input to "selected text" or "word" and output to "show as tool tip".

C6 - Choose a shortcut.





source :
A : http://blog.macromates.com/2006/getting-more-bundles/

B&C : modified http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Integrate;action=display;num=1211907539;start=0
Re: Processing & TextMate (mac) - get it work
Reply #1 - Sep 30th, 2008, 11:33pm
 
First bug : if your current file's path has a strange character in it, the run command will not work. Someone knows a workaround ?
Re: Processing & TextMate (mac) - get it work
Reply #2 - Oct 2nd, 2008, 1:54pm
 
Nice!

And for a workaround: don't use strange characters in the path! For a solution: uh, sorry, no Mac at hand... :-P
Page Index Toggle Pages: 1