Last active
August 29, 2015 14:09
-
-
Save ryseto/552afd67e162531a5020 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# You need to put the following in ~/.emacs.d/init.el. | |
# (if window-system | |
# (progn | |
# (require 'server) | |
# (unless (server-running-p) (server-start)))) | |
# | |
EMACS_PID_ALL=`pgrep -d ' ' Emacs` | |
EMACS_ACTIVE=0 | |
for EMACS_PID in $EMACS_PID_ALL | |
do | |
EMACS_CMD="" | |
[ -n "$EMACS_PID" ] && EMACS_CMD="`ps -p ${EMACS_PID} -o command | tail -1`" | |
EMACS_ACTIVE=`echo ${EMACS_CMD} | grep -q -e" -nw" && echo 0 || echo 1` | |
[ $EMACS_ACTIVE -eq 1 ] && break | |
done | |
[ $EMACS_ACTIVE -eq 0 ] && (open -a Emacs.app "$2" && sleep 1) | |
## Self-contained Emacs.app | |
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient --no-wait +$1 "$2" | |
## Homebrew | |
#/usr/local/bin/emacsclient --no-wait +$1 "$2" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment