]> git.donarmstrong.com Git - bin.git/blobdiff - sane_editor
add reset usb bus command
[bin.git] / sane_editor
index b12b99ff4d5ad48af9463ed4cf862e263d88d767..fbfdb751f06e4251d7fb6943747f0cfdbb62ec5b 100755 (executable)
@@ -9,17 +9,25 @@
 # ed
 
 # modify the gsrvdir check to search for directories that are owned by me
+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 "$@";
+    else
+           exec emacsclient --alternate-editor /usr/bin/vi -c "$@";
+    fi;
+fi;
 if [ -x /usr/bin/gnuclient ] && [ -x /usr/bin/emacs ]; then
     if ( gnuclient -batch < /dev/null >/dev/null); then
        exec gnuclient "$@";
     fi;
 fi;
-if [ -x /usr/bin/jed ]; then
-    exec jed "$@";
-fi;
-if [ -x /usr/bin/juno ]; then
-    exec juno "$@";
-fi;
 if [ -x /usr/bin/vi ]; then
     exec vi "$@";
 fi;
@@ -30,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;