#!/bin/bash

if [ -z "$EMACS" ]; then
	EMACS=emacs23
fi

# check if it is reachable
emacsclient -e '(+ 1 2)' && exit

# no, kill all instances
killall $EMACS

# remove locks
rm -f ~/.emacs.desktop.lock

# go
exec $EMACS

