chiark / gitweb /
312995fb62be3a4ac82ef72582c43a3f83798502
[profile] / bin / mdw-editor
1 #! /bin/sh
2
3 set -e
4 editor=${MDW_EDITOR-ed}
5 emacsclient=t
6 [ -t 0 -a -t 1 ] || TERM=dumb
7 case "$EDITOR,$VISUAL,$TERM" in
8   mdw-editor,mdw-editor,dumb) editor=emacsclient emacsclient=nil;;
9   mdw-editor,mdw-editor,*);;
10   mdw-editor,*,*) editor=$VISUAL;;
11   *,*,*) editor=$EDITOR;;
12 esac
13 case "$emacsclient" in
14   t) exec emacsclient -nw -a "$editor" "$@";;
15   nil) exec $editor "$@";;
16 esac