#!/bin/bash # note: starting emacs server can hang due to errors in init files # which don't cause problems for non-server emacs. And things # that aren't errors can cause hang too, like when I added gnus # git to load path. # I was experimenting with running # under gdb always to diagnose any hangs/crashes # and it won't work due to a gdb crash: # gdb -ex="set follow-fork-mode child" -ex=r -ex=quit --args emacsclient -nc # -n = --no-wait, go into background # -c = create new frame instead of reusing the current frame # -a = alternate editor, empty string makes it start emacs daemon. # This is also set via env variable, but that doesn't propagate everywhere. if pgrep -u $EUID emacsclient && (( $# )); then emacsclient -a "" -n "$@" else emacsclient -a "" -nc "$@" fi