[Conkeror] A few issues with spawning external editors
Trent W. Buck
trentbuck at gmail.com
Mon Jun 30 18:00:49 PDT 2008
Axel Beckert <abe at deuxchevaux.org> writes:
> b) spawing external editors doesn't work right if the configured
> editor needs a terminal (i.e. doesn't open its own window). In my
> example I have $EDITOR set to zile (Zile Is a Lossy Emacs :-), a
> small, fast and efficient editor with Emacs look and feel.
It's not possible for conkeror to accurately determine whether $EDITOR
requires a controlling xterm (consider: $EDITOR may be a wrapper script
that heuristically decides which "real" editor to run).
If you always start an xterm, then you'll get a useless xterm when
EDITOR in cases like emacsclient -c or gedit. Therefore it seems best
for conkeror to assume that $EDITOR allocates its own terminal if
necessary.
However, conkeror should probably connect stdin to /dev/null, so that
when line editors (ed) and ncurses editors (zile et al) immediately
exit, rather than "hanging". conkeror might also redirect stdout and
stderr to a buffer (rather than conkeror's parent xterm), so that if
$EDITOR exits unsuccessfully, conkeror can display the error message.
These issues should only affect people who start conkeror (or X) from a
terminal; if you use e.g. gdm to start X and ratpoison's C-t ! to start
conkeror, then stdin should already be /dev/null.
> In that case the spawned editor seems to be half connected to the
> terminal conkeror has been called in (if any), but doesn't come up
> there completely. My zsh argues that conkeror suddenly expects tty
> input, so something happened on that terminal, but the editor
> doesn't show up though and the field stays disabled (greyed out).
See above regarding stdin being /dev/null.
> What could make the situation slightly better is the following
> patch which first checks the $VISUAL environment variable before
> checking $EDITOR or falling back to emacs because $VISUAL is
> usually only set to editors with GUI while $EDITOR can be set to
> some text-mode only editor.
This should be done in your Debian package even if upstream doesn't; you
should also patch the Debian version to fall back to sensible-editor
rather than (say) vi or emacs.
> Unfortunately I have no idea how to test if some editor needs a
> terminal, but if we can manage to get a spawned text-mode editor
> can connect to the terminal conkeror was called from (if any), this
> would a big step towards the perfect solution for this issue. :-)
You can't be sure that conkeror was started from a terminal. I
generally think trying to start an editor there is the wrong way to go
about things, but if you make it work I'm still interested in the
details :-)
More information about the Conkeror
mailing list