setup: OpenBSD make(1) doesn't have `-C'.
[profile] / bin / mdw-editor
CommitLineData
e04c4857
MW
1#! /bin/sh
2
3set -e
4editor=${MDW_EDITOR-ed}
7e503811
MW
5emacsclient=$(
6 emacsclient --eval '(>= emacs-major-version 23)' 2>/dev/null || :)
8ec7231c 7[ -t 0 -a -t 1 ] || TERM=dumb
e04c4857 8case "$EDITOR,$VISUAL,$TERM" in
7a24847d
MW
9 mdw-editor,mdw-editor,dumb | \
10 mdw-editor,mdw-editor,emacs | \
11 mdw-editor,mdw-editor,eterm*)
12 editor=emacsclient emacsclient=nil;;
e04c4857 13 mdw-editor,mdw-editor,*);;
e04c4857 14 mdw-editor,*,*) editor=$VISUAL;;
9db17a65 15 *,*,*) editor=$EDITOR;;
e04c4857 16esac
e2fd2096
MW
17case "$emacsclient" in
18 t) exec emacsclient -nw -a "$editor" "$@";;
7e503811 19 *) exec $editor "$@";;
e2fd2096 20esac