I am working on an Emacs extension for using the Julia REPL inside
Emacs. Since debugging with Gallium needs more terminal capabilities
than ESS allows, I am basing it on term.el.
By default, term in Emacs sends cursor keys as \eOA, \eOB, ... for up,
down, ... . I found that I need to change them to \e[A and \e[B to make
the Julia REPL recall history correctly.
I don't know much about terminals, so mostly I found this out by
experiment. I am wondering though if either term.el, Julia's readline,
or something in between is behaving incorrectly. As far as I understand,
term.el advertises keys correctly:
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation:
http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.5.0 (2016-09-19 18:14 UTC)
_/ |\__'_|_|_|\__'_| | Official
http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu
julia> ENV["TERMCAP"]
"eterm-color:li#44:co#83:cl=\\E[H\\E[J:cd=\\E[J:bs:am:xn:cm=\\E[%i%d;%dH:nd=\\E[C:u
p=\\E[A:ce=\\E[K:ho=\\E[H:pt:al=\\E[L:dl=\\E[M:DL=\\E[%dM:AL=\\E[%dL:cs=\\E[%i%d;%d
r:sf=^J:dc=\\E[P:DC=\\E[%dP:IC=\\E[%d@:im=\\E[4h:ei=\\E[4l:mi::so=\\E[7m:se=\\E[m:u
s=\\E[4m:ue=\\E[m:md=\\E[1m:mr=\\E[7m:me=\\E[m:UP=\\E[%dA:DO=\\E[%dB:LE=\\E[%dD:RI=
\\E[%dC:kl=\\EOD:kd=\\EOB:kr=\\EOC:ku=\\EOA:kN=\\E[6~:kP=\\E[5~:@7=\\E[4~:kh=\\E[1~
:mk=\\E[8m:cb=\\E[1K:op=\\E[39;49m:Co#8:pa#64:AB=\\E[4%dm:AF=\\E[3%dm:cr=^M:bl=^G:d
o=^J:le=^H:ta=^I:se=\\E[27m:ue=\\E[24m:kb=^?:kD=^[[3~:sc=\\E7:rc=\\E8:r1=\\Ec:"
If anyone is interested, preliminary code for the minor mode is here:
https://github.com/tpapp/julia-repl/
Can be used in with julia-emacs.
Any help or advice would be appreciated (again, I know little about how
these things are supposed to work).
Best,
Tamas