From ecb606acccb32483a7aad290547bc5b853094158 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Tue, 6 Dec 2011 04:27:30 +0000 Subject: [PATCH] update sane editor --- sane_editor | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- 2.39.2