Passing escape sequences to shells within ansi-term in Emacs
3
votes
1
answer
2179
views
In a regular terminal (e.g. iTerm2 on OS X) I can connect to a database, e.g.
> psql ....
and then, as I type my command in
psql
, e.g.
$ select foo from bar
I can move around (as I type psql commands) using the standard Alt+b
and Alt+f
.
However, if I try to do this in a shell within Emacs (ansi-term
), it doesn't work.
More specifically, if I start a shell (e.g. Bash) within ansi-term
, the keystrokes Alt+b
and Alt+f
work fine in the Unix shell (in this case, Bash), **BUT** if I then drop into psql
from within the shell, the keystrokes Alt+b
nor Alt+f
stop working (the keystrokes won't move the cursor, and I can't keep typing commands properly anymore)
Why is this? And how can fix this behavior?
## Update 1:
I narrowed the problem and the line in my .zshrc
that causes this behavior is the following one:
TERM=xterm-256color
I have this line because its's the best solution that I found to fix the problem that I report in this thread:
Emacs multi-term not displaying special characters correctly
## Update 2 (solution, but why?):
I found the solution in this thread: Weird character zsh in emacs terminal . As the top answer says, I had to create eterm-color
terminfo
by using following command: (note that the terminfo
path may be different from your system)
# If you use Cocoa Emacs or Carbon Emacs
tic -o ~/.terminfo /Applications/Emacs.app/Contents/Resources/etc/e/eterm-color.ti
Asked by Amelio Vazquez-Reina
(42851 rep)
Jan 29, 2014, 09:40 PM
Last activity: Apr 21, 2016, 10:57 PM
Last activity: Apr 21, 2016, 10:57 PM