Commit | Line | Data |
---|---|---|
e04c4857 MW |
1 | #! /bin/sh |
2 | ||
3 | set -e | |
4 | editor=${MDW_EDITOR-ed} | |
6f75a47e MW |
5 | case ${TMP+t},${TMPDIR+t} in |
6 | t,) TMPDIR=$TMP; export TMPDIR ;; | |
7 | esac | |
7e503811 MW |
8 | emacsclient=$( |
9 | emacsclient --eval '(>= emacs-major-version 23)' 2>/dev/null || :) | |
8ec7231c | 10 | [ -t 0 -a -t 1 ] || TERM=dumb |
e04c4857 | 11 | case "$EDITOR,$VISUAL,$TERM" in |
7a24847d MW |
12 | mdw-editor,mdw-editor,dumb | \ |
13 | mdw-editor,mdw-editor,emacs | \ | |
14 | mdw-editor,mdw-editor,eterm*) | |
15 | editor=emacsclient emacsclient=nil;; | |
e04c4857 | 16 | mdw-editor,mdw-editor,*);; |
e04c4857 | 17 | mdw-editor,*,*) editor=$VISUAL;; |
9db17a65 | 18 | *,*,*) editor=$EDITOR;; |
e04c4857 | 19 | esac |
e2fd2096 MW |
20 | case "$emacsclient" in |
21 | t) exec emacsclient -nw -a "$editor" "$@";; | |
7e503811 | 22 | *) exec $editor "$@";; |
e2fd2096 | 23 | esac |