-
-
Save alexmurray/6bf59b4d7338538d53b0 to your computer and use it in GitHub Desktop.
Shutdown Emacs Server
This file contains 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 | |
# Shamelessly taken from http://mjwall.com/blog/2013/10/04/how-i-use-emacs/ | |
# simple script to shutdown the running Emacs daemon | |
# emacsclient options for reference | |
# -a Alternate editor, runs bin/false in this case | |
# -e eval the script | |
# If the server-process is bound and the server is in a good state, then kill | |
# the server | |
server_ok() { | |
emacsclient -a "false" -e "(boundp 'server-process)" | |
} | |
if [ "t" == "$(server_ok)" ]; then | |
echo "Shutting down Emacs server" | |
# wasn't removing emacs from ALT-TAB on mac | |
# emacsclient -e "(server-force-delete)" | |
emacsclient -e '(kill-emacs)' | |
else | |
echo "Emacs server not running" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment