From: Mark Wooding Date: Mon, 12 Dec 2011 23:48:43 +0000 (+0000) Subject: bin/mdw-editor: Set TMPDIR from TMP if it's unset. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/6f75a47e1fda9f8c718d0193b9f18ff1b73a1952?ds=sidebyside bin/mdw-editor: Set TMPDIR from TMP if it's unset. Setuid programs drop the TMPDIR environment variable. This means that emacsclient can't find the correct socket directory if it's started via `sudo -e', which is annoying. Fortunately, we have a copy of the correct directory lying around, so we can use it to fix things up. --- diff --git a/bin/mdw-editor b/bin/mdw-editor index aa52fd5..c162da3 100755 --- a/bin/mdw-editor +++ b/bin/mdw-editor @@ -2,6 +2,9 @@ set -e editor=${MDW_EDITOR-ed} +case ${TMP+t},${TMPDIR+t} in + t,) TMPDIR=$TMP; export TMPDIR ;; +esac emacsclient=$( emacsclient --eval '(>= emacs-major-version 23)' 2>/dev/null || :) [ -t 0 -a -t 1 ] || TERM=dumb