[darcs-users] darcs interactive use from non-terminals

Judah Jacobson judah.jacobson at gmail.com
Wed Apr 1 01:56:15 UTC 2009


On Tue, Mar 31, 2009 at 4:48 PM, Trent W. Buck <trentbuck at gmail.com> wrote:
> Judah Jacobson <judah.jacobson at gmail.com> writes:
>> I think Haskeline+darcs already takes care of this (at least, it
>> should with the darcs HEAD and haskeline>=0.6.1.).  It only provides
>> the fancy user interaction if the "terminal" stdin has echo=on (which
>> is false in the emacs shell).
>
> Checking if input should be printed sounds like a very inaccurate way to
> detect when you're dealing with a line-oriented terminal emulator.
> Surely there's a more appropriate terminfo property?

There isn't one that covers this, AFAIK.  Also, TERM=dumb in M-x shell
which is not very helpful.

Anyway, when echo's turned off the user can't see what they're typing,
so I don't expect the interactive UI to be very useful in that case.

The real problem with treating emacs' shell as an interactive terminal
is that you end up with the input echoed twice (once by emacs, and
once by Haskeline re-displaying each character).

> Failing that, would it be more robust to simply parse and discard a ^J
> character seen after a prompt?  That was my impression of how Darcs
> worked before Haskeline (though I never examined the code).

We do that too, but only when not in an interactive terminal. The
exact behavior is recorded in the Haddock docs:

http://hackage.haskell.org/packages/archive/haskeline/0.6.1.3/doc/html/System-Console-Haskeline.html

(in the section "Reading user input").

The echo check is what readline does and it seems to be pretty robust
in my own tests, but please do let me know if you run into a case
where things don't seem to be working properly.

Thanks,
-Judah


More information about the darcs-users mailing list