On Tue, Jan 18, 2005 at 10:20:13PM -0500, John W. Eaton wrote: > On 18-Jan-2005, Dirk Eddelbuettel <[EMAIL PROTECTED]> 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 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]