X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=sane_editor;h=fbfdb751f06e4251d7fb6943747f0cfdbb62ec5b;hb=57e5edd190fa2c3fff39ecc93660eb8e582cdb33;hp=03aab788084f10c99c8b8bd0c264094a39ef9c11;hpb=9f1fb522f847fccfbaeed4906ad7bbb6e3eaea5d;p=bin.git diff --git a/sane_editor b/sane_editor index 03aab78..fbfdb75 100755 --- a/sane_editor +++ b/sane_editor @@ -12,12 +12,15 @@ if [ -x /usr/bin/emacsclient ] && [ -x /usr/bin/emacs ]; then # reset the tempdir to deal with setuid things clearing it export TMPDIR="$(echo ~/tmp)"; - if ( emacsclient -n -e '()' /dev/null); then - if [ -z "$DISPLAY" ]; then - exec emacsclient -c -nw "$@"; - else - exec emacsclient -c "$@"; - fi; + # If TERM is set to dumb, reset it to linux. (emacs does this for + # some reason) + if [ "$TERM" = "dumb" ]; then + TERM="linux" + fi; + if [ -z "$DISPLAY" ]; then + exec emacsclient --alternate-editor /usr/bin/vi -c -nw "$@"; + else + exec emacsclient --alternate-editor /usr/bin/vi -c "$@"; fi; fi; if [ -x /usr/bin/gnuclient ] && [ -x /usr/bin/emacs ]; then @@ -35,4 +38,4 @@ if [ -x /usr/bin/ed ]; then exec ed "$@"; fi; echo "Unable to find a suitable editor" >/dev/stderr; -exit 1; \ No newline at end of file +exit 1;