Skip to content

Instantly share code, notes, and snippets.

@Bad-ptr
Last active December 29, 2015 06:19
Show Gist options
  • Save Bad-ptr/7628186 to your computer and use it in GitHub Desktop.
Save Bad-ptr/7628186 to your computer and use it in GitHub Desktop.
start or kill emacs daemon
#!/bin/bash
# https://gist.github.com/Bad-ptr/7628186
DAEMON='server';
if [ -n "$1" ];
then
DAEMON="$1"
fi
emacsclient -f "$DAEMON" -a false -e 't';
if [ "$?" -eq 1 ];
then
#rm ~/.emacs.desktop.lock
rm "~/.emacs.d/server/$DAEMON"
emacs --daemon="$DAEMON" --eval '(setq server-use-tcp t)' "${@:2}" </dev/null
else
emacsclient -f "$DAEMON" -a false -e '(kill-emacs)' </dev/null
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment