Skip to content

Instantly share code, notes, and snippets.

@developernotes
Created July 22, 2010 14:24
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 developernotes/486027 to your computer and use it in GitHub Desktop.
Save developernotes/486027 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Send the file to our running Emacs and bring it to the foreground.
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient "${1}" \
2> /dev/null \
&& open -a Emacs
# If that failed, then open a new emacs visiting the file.
if [ $? -ne 0 ]; then
EOPEN_DIR="${PWD}" EOPEN_FILE="${1}" open -a Emacs
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment