Skip to content

Instantly share code, notes, and snippets.

@masaedw
Created January 6, 2012 16:27
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save masaedw/1571296 to your computer and use it in GitHub Desktop.
Save masaedw/1571296 to your computer and use it in GitHub Desktop.
run emacs.app or emacsclient on Mac OS X
function e() {
if [ -z `pgrep Emacs` ]; then
env LANG=C open -a Emacs "$@"
return
fi
local client="/Applications/MacPorts/Emacs.app/Contents/MacOS/bin/emacsclient"
local uid=`id -u`
local socket="$TMPDIR"/emacs"$uid"/server
if [ ! -e "$socket" ]; then
socket=`getconf DARWIN_USER_TEMP_DIR`emacs"$uid"/server
fi
$client -n -s $socket "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment