changeset 5111:aa9bc151d2fa

[project @ 2005-01-19 03:15:31 by jwe]
author jwe
date Wed, 19 Jan 2005 03:15:31 +0000
parents ea96466f98ea
children 634abff6677e
files ChangeLog octave-bug.in
diffstat 2 files changed, 31 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Jan 19 02:11:53 2005 +0000
+++ b/ChangeLog	Wed Jan 19 03:15:31 2005 +0000
@@ -1,3 +1,7 @@
+2005-01-18  John W. Eaton  <jwe@octave.org>
+
+	* octave-bug.in: Try harder to find default editor.
+
 2004-12-17  John W. Eaton  <jwe@octave.org>
 
 	* configure.in: Use AC_GNU_SOURCE.
--- a/octave-bug.in	Wed Jan 19 02:11:53 2005 +0000
+++ b/octave-bug.in	Wed Jan 19 03:15:31 2005 +0000
@@ -63,7 +63,33 @@
 
 TEMP=/tmp/octave-bug.$$
 
-: ${EDITOR=emacs}
+if [ -z "$DEFEDITOR" ] && [ -z "$EDITOR" ]; then
+  if [ -x /usr/bin/editor ]; then
+    DEFEDITOR=editor
+  elif [ -x /usr/local/bin/ce ]; then
+    DEFEDITOR=ce
+  elif [ -x /usr/local/bin/emacs ]; then
+    DEFEDITOR=emacs
+  elif [ -x /usr/contrib/bin/emacs ]; then
+    DEFEDITOR=emacs
+  elif [ -x /usr/bin/emacs ]; then
+    DEFEDITOR=emacs
+  elif [ -x /usr/bin/xemacs ]; then
+    DEFEDITOR=xemacs
+  elif [ -x /usr/contrib/bin/jove ]; then
+    DEFEDITOR=jove
+  elif [ -x /usr/local/bin/jove ]; then
+    DEFEDITOR=jove
+  elif [ -x /usr/bin/vi ]; then
+    DEFEDITOR=vi
+  else
+    echo "octave-bug: No default editor found: attempting to use vi" >&2
+    DEFEDITOR=vi
+  fi
+fi
+
+: ${EDITOR=$DEFEDITOR}
+
 : ${PAGER=more}
 
 trap 'rm -f $TEMP $TEMP.x; exit 1' 1 2 3 13 15