Created
August 8, 2011 16:57
-
-
Save volh/1132180 to your computer and use it in GitHub Desktop.
Revisions
-
volh revised this gist
Aug 8, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ case "$1" in ;; stop) stat_busy "Stopping Emacs" su $USERNAME -c "$EMACSCLIENT --eval \"$EVALEXIT\"" && ( rm_daemon emacs; stat_done ) || stat_fail ;; restart|force-reload) $0 stop -
volh renamed this gist
Aug 8, 2011 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
volh created this gist
Aug 8, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ #! /bin/sh . /etc/rc.conf . /etc/rc.d/functions #change this. too bad emacs daemon can't really work in mutli-user mode. for now. USERNAME=volh DESC="Run the emacs daemon." NAME=emacs #change this DAEMON=/usr/bin/$NAME DAEMON_ARGS="--daemon" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/rc.d/$NAME #change this EMACSCLIENT=/usr/bin/emacsclient #EVALEXIT="(progn (setq kill-emacs-hook 'nil) (kill-emacs))" # This one will save buffers in any case, without prompt(as save-buffers-kill-emacs will unconditionally do). EVALEXIT="(progn (save-some-buffers t t)(kill-emacs))" # This will save the desktop, but not the buffers themselves #EVALEXIT="(progn (desktop-save-in-desktop-dir)(kill-emacs))" case "$1" in start) stat_busy "Starting Emacs" su $USERNAME -c "$DAEMON $DAEMON_ARGS" > /dev/null && (add_daemon emacs; stat_done) || stat_fail ;; stop) stat_busy "Stopping Emacs" su $USERNAME -c "nohup $EMACSCLIENT --eval \"$EVALEXIT\"" && ( rm_daemon emacs; stat_done ) || stat_fail ;; restart|force-reload) $0 stop sleep 1 $0 start ;; *) echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 3 ;; esac