#!/bin/sh
# emacspeak - execute emacs with speech enhancements
#$Id: emacspeak.def,v 11.0 1999/11/29 16:58:57 raman Exp $
    if [ -f /etc/emacspeak.conf ]
    then
    source /etc/emacspeak.conf
fi

if [ -e $HOME/.emacs ]
then
	INITSTR="-l $HOME/.emacs"
fi

CL_ALL=""
for CL in $* ; do
	if [ "$CL" = "-o" ]; then
		DTK_PROGRAM=outloud
		export DTK_PROGRAM
	elif [ "$CL" = "-m" ]; then
		DTK_PROGRAM=mbrola
		export DTK_PROGRAM
	elif [ "$CL" = "-q" ]; then
		INITSTR=""
	else
		CL_ALL="$CL_ALL $CL"
	fi
done

for f in /usr/share/emacs/site-lisp/emacspeak/*servers.el; do
    if [ -f "$f" ]; then
        INITSTR="-l $f $INITSTR"
    fi
done

EMACS_UNIBYTE=1
export EMACS_UNIBYTE
exec emacs -q -l /usr/share/emacs/site-lisp/emacspeak/emacspeak-setup.el $INITSTR $CL_ALL
