Skip to content

@nicferrier /gist:1966843
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Emacs RC script - a script to do Emacs daemonization control
#!/bin/bash
WHO=$(whoami)
[ "$WHO" != "nferrier" ] && exec su -c "$0 $*" - nferrier
EMACS=/home/nferrier/usr/emacs/bin/emacs
SERVERNAME=elnode
SOCKETPATH=/tmp/emacs$UID/$SERVERNAME
case $1 in
start)
${EMACS}client -s $SOCKETPATH -e '(print (emacs-version))'
if [ $? -ne 0 ] ; then $EMACS --daemon=$SERVERNAME ; fi
;;
stop)
${EMACS}client -s $SOCKETPATH -e '(print (emacs-version))'
if [ $? -eq 0 ] ; then ${EMACS}client -s $SOCKETPATH -e '(kill-emacs)' *scratch* ; fi
;;
status)
if [ ! -S $SOCKETPATH ] ; then exit 1 ; fi
${EMACS}client -s $SOCKETPATH -e '(print (emacs-version))'
;;
esac
# End
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.