chiark / gitweb /
bin/mdw-editor: Find out about the Emacs server version.
[profile] / bin / mdw-editor
index 312995fb62be3a4ac82ef72582c43a3f83798502..96387e8514203cba19830f59d8257d71c063e416 100755 (executable)
@@ -2,7 +2,8 @@
 
 set -e
 editor=${MDW_EDITOR-ed}
-emacsclient=t
+emacsclient=$(
+  emacsclient --eval '(>= emacs-major-version 23)' 2>/dev/null || :)
 [ -t 0 -a -t 1 ] || TERM=dumb
 case "$EDITOR,$VISUAL,$TERM" in
   mdw-editor,mdw-editor,dumb) editor=emacsclient emacsclient=nil;;
@@ -12,5 +13,5 @@ case "$EDITOR,$VISUAL,$TERM" in
 esac
 case "$emacsclient" in
   t) exec emacsclient -nw -a "$editor" "$@";;
-  nil) exec $editor "$@";;
+  *) exec $editor "$@";;
 esac