@ wrote... (9 years, 9 months ago)

Open files with jEdit from the terminal is a pain. Here's a script to help.

Not sure if it was necessary, but I did the following (as root):

cd /Applications/jEdit.app/Contents/MacOS/
ln -s /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub jedit

I put the following in /opt/local/bin/jedit but anywhere in your path wil work. Make sure it's executable: chmod 755 /opt/local/bin/jedit.

#!/usr/bin/env python

import os,sys
from subprocess import Popen, PIPE, STDOUT

jedit = "/Applications/jEdit.app/Contents/MacOS/jedit"
jedit_args = "-reuseview"
curr_dir = os.path.realpath( os.curdir )

for i in range( len(sys.argv) ):
    arg = sys.argv[i]

    if arg[0] == "-": continue    # argument to jedit
    if arg[0] == "/": continue    # absolute path

    # assume a relative pathname now
    filename = os.path.join( curr_dir, arg )
    sys.argv[i] = filename

cmd = [ jedit, jedit_args, ] + sys.argv[1:]

#print cmd
# subprocess.call( cmd )                 # run in foreground

# by redirecting stderr, stdout we won't see jedit spam, might be a mistake
pid = Popen( cmd ).pid    # run in background
Category: tech, Tags: osx
Comments: 0
Click here to add a comment