Discussion:
problem with echo prompting in ghci (visible in emacs)
(too old to reply)
Conal Elliott
2008-11-11 19:36:01 UTC
Permalink
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20081111/fed2abff/attachment.htm
Andrea Vezzosi
2008-11-11 19:55:17 UTC
Permalink
I get the same behaviour, and when I open ghci in xterm and press Ctrl-D it
also echoes ^D before quitting, which is similar to the problem with
haskell-mode which seems to don't like the echoing of ^J from ghci when one
uses commands like C-u C-c C-t (which should copy the inferred type from the
ghci buffer and insert it in the current file).

I'm using the ghc package from archlinux testing repository, which is built
with libedit 20080712_2.11.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20081112/2de959b2/attachment-0001.htm
Reiner Pope
2008-11-11 20:49:51 UTC
Permalink
Post by Andrea Vezzosi
I get the same behaviour, and when I open ghci in xterm and press Ctrl-D it
also echoes ^D before quitting, which is similar to the problem with
haskell-mode which seems to don't like the echoing of ^J from ghci when one
uses commands like C-u C-c C-t (which should copy the inferred type from the
ghci buffer and insert it in the current file).
I'm using the ghc package from archlinux testing repository, which is built
with libedit 20080712_2.11.
_______________________________________________
Glasgow-haskell-users mailing list
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
I also get the same, see
http://www.haskell.org/pipermail/glasgow-haskell-users/2008-November/015939.html

I don't have a solution, although I put a quick hack in my
haskell-mode code so that C-u C-c C-t works.

Reiner
Conal Elliott
2008-11-16 23:48:53 UTC
Permalink
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
Post by Conal Elliott
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20081116/b673c826/attachment.htm
Judah Jacobson
2008-11-17 01:25:51 UTC
Permalink
Post by Conal Elliott
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
Post by Conal Elliott
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:
http://www.zsh.org/mla/users/2001/msg00014.html (section 3.10)

Hope that helps,
-Judah
Conal Elliott
2008-11-17 10:50:43 UTC
Permalink
Thanks very much, Judah!

Given this info, there's a fairly easy emacs haskell-mode work-around. I
made a shell script "ghci-no-tty" in my ~/bin that contains

# So ghci+readline won't echo input
cat | /usr/local/bin/ghci $*

and used "M-x customize-group" with the "haskell" group to set the "Haskell
Program Name" variable to "/home/conal/bin/ghci-no-tty" (must be full path).

Now there's no more input echoing, and commands like automatic signature
insertion ("\C-c\C-t") work again.

Hooray!

- Conal

On Sun, Nov 16, 2008 at 10:31 PM, Judah Jacobson
Post by Conal Elliott
Post by Conal Elliott
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
Post by Conal Elliott
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
Post by Conal Elliott
Post by Conal Elliott
built it from sources. At the time I didn't have libedit-dev, so today
I
Post by Conal Elliott
Post by Conal Elliott
installed libedit-dev (version 2.11~20080614 on ubuntu), did a clean
make &
Post by Conal Elliott
Post by Conal Elliott
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.
http://www.zsh.org/mla/users/2001/msg00014.html (section 3.10)
Hope that helps,
-Judah
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20081117/d617968a/attachment-0001.htm
Loading...