From 79334fd20b0bf56e3c4106900c0dd23445b0fb3f Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Thu, 18 Jan 2024 15:48:27 -0800 Subject: [PATCH] handle TERM being set to dumb (Unknown term in emacs) --- sane_editor | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sane_editor b/sane_editor index dd1aec7..fbfdb75 100755 --- a/sane_editor +++ b/sane_editor @@ -12,10 +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 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 "$@"; + exec emacsclient --alternate-editor /usr/bin/vi -c -nw "$@"; else - exec emacsclient --alternate-editor /usr/bin/vi -c "$@"; + exec emacsclient --alternate-editor /usr/bin/vi -c "$@"; fi; fi; if [ -x /usr/bin/gnuclient ] && [ -x /usr/bin/emacs ]; then @@ -33,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; -- 2.39.2