From: Don Armstrong Date: Tue, 6 Dec 2011 04:27:30 +0000 (+0000) Subject: update sane editor X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ecb606acccb32483a7aad290547bc5b853094158;p=bin.git update sane editor --- diff --git a/sane_editor b/sane_editor index 56c98d9..44cf0af 100755 --- a/sane_editor +++ b/sane_editor @@ -10,7 +10,15 @@ # modify the gsrvdir check to search for directories that are owned by me if [ -x /usr/bin/emacsclient ] && [ -x /usr/bin/emacs ]; then - exec emacsclient -c "$@"; + # reset the tempdir to deal with setuid things clearing it + export TMPDIR="$(echo ~/tmp)"; + if ( emacsclient -n -e '()' /dev/null); then + if [ -n "$DISPLAY" ]; then + exec emacsclient -nw "$@"; + else + exec emacsclient -c "$@"; + fi; + fi; fi; if [ -x /usr/bin/gnuclient ] && [ -x /usr/bin/emacs ]; then if ( gnuclient -batch < /dev/null >/dev/null); then