Skip to content

Instantly share code, notes, and snippets.

@honnix
Created February 10, 2014 20:14
Show Gist options
  • Save honnix/8923353 to your computer and use it in GitHub Desktop.
Save honnix/8923353 to your computer and use it in GitHub Desktop.
emacsclient enhanced
#!/bin/sh
if [ $# -ne 1 ]
then
echo "use: ec <file>"
exit -1
fi
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n $1 > /dev/null 2>&1
if [ $? -eq 1 ]
then
/Applications/Emacs.app/Contents/MacOS/Emacs &
while [ 1 ]
do
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n $1 > /dev/null 2>&1
if [ $? -eq 0 ]
then
exit 0
else
sleep 1
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment