From 7e50381192d916a5034b87956725b5b86a9c58a2 Mon Sep 17 00:00:00 2001 Message-Id: <7e50381192d916a5034b87956725b5b86a9c58a2.1718286374.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sat, 21 Nov 2009 11:46:18 +0000 Subject: [PATCH] bin/mdw-editor: Find out about the Emacs server version. Organization: Straylight/Edgeware From: Mark Wooding Emacs 22's client doesn't like the `-nw' option, unsurprisingly. So interrogate it first to find out what's going on. I suppose this also means that there's not a great deal of point in using the `-a' option, but it doesn't do a great deal of harm. --- bin/mdw-editor | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/mdw-editor b/bin/mdw-editor index 312995f..96387e8 100755 --- a/bin/mdw-editor +++ b/bin/mdw-editor @@ -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 -- [mdw]