#!/usr/local/bin/wish -f
#
# Invoke sedit as an editor for news
#
# Tin configuration (~/.tin/tinrc)
#                                 default_editor_format=sedit-article
# Knews configuration (in $APPLERESDIR/Knews or ~/.Xdefaults)
#	Knews.editCommand:      sedit-article +%i %s
#
#Gareth Owen (g.owen@aston.ac.uk) 6-Feb-96
#-----------------------------------

# Name of binary
set exmh_bin /usr/local/bin/exmh
# what name it'll give  itself 
set exmh_interp exmh

# if exmh isn't running , start it up and wait till it's there before continuing
if {[lsearch [winfo interps] $exmh_interp ]==-1} {
    exec $exmh_bin -iconic 2>1 > /dev/null &
    while {[lsearch [winfo interps] $exmh_interp ]==-1} {
	after 1000       
    }
}

if {[llength $argv]} { 
    set fn [lindex $argv 0]
} else { # tin uses ~/.article
    set fn $env(HOME)/.article
}

regsub -all {\.} $fn _ seditwin
set seditwin ".sedit$seditwin"

send exmh Sedit_Start $fn

# Take away the temptation of the Send button (Save & Quit is the way out)
send exmh $seditwin.but.send configure -state disabled

# And hang around till the job's done
while {[string compare [send exmh wm state $seditwin] withdrawn]} {
    after 500
}     

exit
#EOF

