From bug-request at octave dot org Wed Jan 19 20:34:49 2005 Subject: Re: Bug#290470: octave2.1: Octave's bug_report needs emacs or $EDITOR From: Dirk Eddelbuettel To: "John W. Eaton" Cc: Dirk Eddelbuettel , Rafael Laboissiere , bug@octave.org, Thomas Weber , 290470@bugs.debian.org Date: Wed, 19 Jan 2005 20:38:31 -0600 On Tue, Jan 18, 2005 at 10:20:13PM -0500, John W. Eaton wrote: > On 18-Jan-2005, Dirk Eddelbuettel wrote: > > | I don't really know either, or I would have suggested it. We, as you know, > | try to get by without environment variables. A Debian-only fix therefore > | would be to talk to /usr/bin/sensible-editor, which is guaranteed to be > | present. But that doesn't help in the general case for Octave. > | > | It may not be worth going overboard here. You could do some autoconf magic > | to check for emacs, xemacs, vi and remember the choice. Or do that with > | shell when the above is executed. > > That would be better, since the binary may be running on a system > different from the one where configure was run. > > | In either event, I think it would be fair > | to abort with a message "no editor found, tempfile in /tmp/$foo left for > | manual continuation" or some such. > > I think we already do something like this: > > devzero:260> EDITOR=foobar octave-bug > /usr/bin/octave-bug: line 226: foobar: command not found > problems with edit -- no bug report submitted > saving message in /home/jwe/dead-octave-bug-1 Right -- /usr/bin/R uses similar tricks to use env. vars when present, or or default when not. It's a nice shell programming feature. > OK, I just checked the bashbug script (which I used as the starting > point for octave-bug way back when) and it now uses > > 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 "$0: No default editor found: attempting to use vi" >&2 > DEFEDITOR=vi > fi > fi > > : ${EDITOR=$DEFEDITOR} > > so I'll copy this method. *Much* better. Good choice. Dirk -- Better to have an approximate answer to the right question than a precise answer to the wrong question. -- John Tukey as quoted by John Chambers ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------