Created
March 27, 2014 15:11
-
-
Save jhrr/9809753 to your computer and use it in GitHub Desktop.
some functions for safely killing and restarting the emacs daemon
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
server_ok() { | |
emacsclient -a "false" -e "(boundp 'server-process)" | |
} | |
function ek { | |
if [ "t" == "$(server_ok)" ]; then | |
echo "Shutting down Emacs server" | |
emacsclient -e '(kill-emacs)' | |
else | |
echo "Emacs server not running" | |
fi | |
} # shutdown the running emacs daemon if the server-process is bound | |
# and the server is in a good state | |
function ers { | |
if [ "t" == "$(server_ok)" ]; then | |
echo "Shutting down emacs server..." | |
emacsclient -e '(kill-emacs)' | |
echo "Restarting emacs server..." | |
emacs -u $USER --daemon --eval '(server-start)' | |
emacsclient --no-wait --create-frame | |
else | |
echo "Emacs server not running, cannot restart" | |
fi | |
} # safely shutdown and restart the emacs daemon |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment