Skip to content

Instantly share code, notes, and snippets.

@nevali
Created May 12, 2011 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nevali/969515 to your computer and use it in GitHub Desktop.
Save nevali/969515 to your computer and use it in GitHub Desktop.
#! /bin/sh
emacsdir=/Local/Applications/Emacs.app
PATH=${emacsdir}/Contents/MacOS/bin:$PATH
export PATH
sock="$TMPDIR/emacs$UID/server"
if test x"$TERM_PROGRAM" = x"Apple_Terminal" || test x"$TERM_PROGRAM" = x"iTerm.app" ; then
if test -e "$sock" ; then
true
else
/usr/bin/open "$emacsdir" || exit $?
fi
while true ; do
if test -e "$sock" ; then
break
fi
sleep 1
done
if test x"$*" = x"" ; then
exit 0
fi
emacsclient "$@" || exit $?
else
/usr/bin/emacs "$@" || exit $?
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment