problem with echo prompting in ghci (visible in emacs)

Judah Jacobson judah.jacobson at
Mon Nov 17 01:31:38 EST 2008

2008/11/16 Conal Elliott <conal at>:
> I'm still looking for a solution to this problem.  I've heard from a few
> people who are affected also, but not any solution.
> Barring a solution to ghci's behavior, does someone have an emacs-based
> workaround?
>   - Conal
> On Tue, Nov 11, 2008 at 4:41 PM, Conal Elliott <conal at> wrote:
>> ghci echoes all of my input in emacs, when run via haskell-mode or via
>> "M-x shell", which then confuses various useful haskell-mode features.  I
>> built it from sources.  At the time I didn't have libedit-dev, so today I
>> installed libedit-dev (version 2.11~20080614 on ubuntu), did a clean make &
>> install, and I get exactly the same behavior.
>> Does anyone have experience in getting through this problem?  Willing to
>> help me out?
>> Thanks,
>>   - Conal

Hi Conal,

The problem is that eshell tells subprocesses that they're running in
a terminal (e.g., when queried via hIsTerminalDevice), but always
echos user input itself regardless of the tty's ECHO attribute.  This
confuses libedit, which assumes that if it's connected to a terminal
then it can turn off echoing in order to run its own rich line editor.

In "M-x shell", you can work around this issue by starting ghci with,
for example, "cat | ghci" to prevent ghci and libedit from trying to
run as if in a terminal.  Probably something similar could be done for
haskell-mode; I'm not familiar enough with emacs to fix it myself.

Incidentally, googling revealed that zsh has a similar issue: (section 3.10)

Hope that helps,

More information about the Glasgow-haskell-users mailing list