For some reason, I'm loosing the up-arrow and DEL keys after launching GHCi from within an ansi-term window in Emacs. (These keys work as expected from within the ansi-term window, before launching GHCi.) And RET doesn't produce a line feed, just a carriage return. I don't observe any of these oddities when launching GHCi from my normal Terminal application under MacOS X.
Using Emac's view-lossage feature I find:
<menu-bar> <Terminal> <Character mode> [term-char-mode]
<up> [term-send-up]
<return> [term-send-raw]
<backspace> [term-send-backspace]
<menu-bar> <Terminal> <Line mode> [term-line-mode]
<up> [previous-line]
<return> [term-send-input]
<backspace> [delete-backward-char]
C-h l [view-lossage]
(Note: The above was taken after launching GHCi from within the ansi-term window of Emacs.)
And it looks like I may want to switch to Line mode while running GHCi. (I normally run the ansi-term window in Character mode, because it gives me an experience more similar to working in the Terminal application.)
It looks like M-p
will recover past commands.
So, if I can figure out how to get the up-arrow remapped to M-p
while in GHCi, then I should be pretty close to my usual GHCi-in-Terminal experience.
However, there's one remaining problem: I'm still not getting a line feed when hitting RET. And this is really screwing things up, both asthetically and functionally.
It's strange, because the RET key typed at either the ansi-term prompt, or the GHCi (launched from within ansi-term) prompt (with the ansi-term window set to Line mode) both send the same command: term-send-input
.
And the ansi-term does the right thing in response to this command.
So, why doesn't GHCi do the right thing?
Perhaps, I need to remap RET to: CR/LF; term-send-input
while in GHCi?
Is this even possible (i.e. - doing application-specific key remapping withing the ansi-term window)?