Paul Kaletta
2011-08-15 11:39:42 UTC
Hi,
I'm using PuTTY 0.61 to ssh into a Solaris 8 box. In Emacs I have F1
through F12 mapped to macros that I use frequently. The F-keys work
flawlessly in Midnight-Commander, but I somehow I can't convince Emacs
to interpret them correctly.
$TERM is set to xterm, and infocmp gives
# Reconstructed via infocmp from file: /usr/share/lib/terminfo/x/
xterm
xterm|vs100|xterm terminal emulator,
am, km, mir, msgr, xenl,
cols#80, it#8, lines#65,
acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J,
cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b,
cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M,
ed=\E[J, el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0,
home=\E[H, ht=\t, hts=\EH, ich=\E[%p1%d@, ich1=\E[@,
il=\E[%p1%dL, il1=\E[L, ind=\n, ka1=\EOq, ka3=\EOs,
kb2=\EOr, kbs=\b, kc1=\EOp, kc3=\EOn, kcub1=\EOD,
kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kent=\EOM,
kf0=\E[21~, kf1=\E[11~, kf10=\EOx, kf2=\E[12~,
kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~,
kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, rc=\E8, rev=\E[7m,
ri=\EM, rmacs=^O, rmkx=\E[?1l\E>, rmso=\E[m,
rmul=\E[m,
rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=@,
sc=\E7,
sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m
%?%p9%t^N%e^O%;,
sgr0=\E[m, smacs=^N, smkx=\E[?1h\E=, smso=\E[7m,
smul=\E[4m, tbc=\E[3g,
when I type "cat -v" and press F1 through F12 I get
^[[11~^[[12~^[[13~^[[14~^[[15~^[[17~^[[18~^[[19~^[[20~^[[21~^[[23~^[[24~
as one would expect. When I press the F-keys, Emacs interprets the
key-press as M-[ followed by the respective suffix. For example, if I
press F1, Emacs interprets that as M-[ followed by 11~. First, it
executes line-to-top, the function which is mapped to M-[, and then
inserts 11~ into the current buffer.
I have tried setting TERM to various strings for which entries in
terminfo exist, and I have always adjusted the settings for the F-keys
in the PuTTY configuration accordingly. Midnight Commander always
works as I would expect, but Emacs doesn't. I managed to get it to
interpet F1-to-F4 correctly, the keys beyond F5 stayed broken. I do
not remember anymore how I did that. It seems that, if I start GNU
screen inside PuTTY, the terminal is set into a different mode, and
PuTTY starts sending different key-codes for the F-keys (screen sets
TERM to vt100, which putty seems to notice).
Best regards,
Paul
I'm using PuTTY 0.61 to ssh into a Solaris 8 box. In Emacs I have F1
through F12 mapped to macros that I use frequently. The F-keys work
flawlessly in Midnight-Commander, but I somehow I can't convince Emacs
to interpret them correctly.
$TERM is set to xterm, and infocmp gives
# Reconstructed via infocmp from file: /usr/share/lib/terminfo/x/
xterm
xterm|vs100|xterm terminal emulator,
am, km, mir, msgr, xenl,
cols#80, it#8, lines#65,
acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~,
bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J,
cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\b,
cud=\E[%p1%dB, cud1=\n, cuf=\E[%p1%dC, cuf1=\E[C,
cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A,
dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M,
ed=\E[J, el=\E[K, el1=\E[1K$<3>, enacs=\E(B\E)0,
home=\E[H, ht=\t, hts=\EH, ich=\E[%p1%d@, ich1=\E[@,
il=\E[%p1%dL, il1=\E[L, ind=\n, ka1=\EOq, ka3=\EOs,
kb2=\EOr, kbs=\b, kc1=\EOp, kc3=\EOn, kcub1=\EOD,
kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kent=\EOM,
kf0=\E[21~, kf1=\E[11~, kf10=\EOx, kf2=\E[12~,
kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~,
kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, rc=\E8, rev=\E[7m,
ri=\EM, rmacs=^O, rmkx=\E[?1l\E>, rmso=\E[m,
rmul=\E[m,
rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, rs2=@,
sc=\E7,
sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m
%?%p9%t^N%e^O%;,
sgr0=\E[m, smacs=^N, smkx=\E[?1h\E=, smso=\E[7m,
smul=\E[4m, tbc=\E[3g,
when I type "cat -v" and press F1 through F12 I get
^[[11~^[[12~^[[13~^[[14~^[[15~^[[17~^[[18~^[[19~^[[20~^[[21~^[[23~^[[24~
as one would expect. When I press the F-keys, Emacs interprets the
key-press as M-[ followed by the respective suffix. For example, if I
press F1, Emacs interprets that as M-[ followed by 11~. First, it
executes line-to-top, the function which is mapped to M-[, and then
inserts 11~ into the current buffer.
I have tried setting TERM to various strings for which entries in
terminfo exist, and I have always adjusted the settings for the F-keys
in the PuTTY configuration accordingly. Midnight Commander always
works as I would expect, but Emacs doesn't. I managed to get it to
interpet F1-to-F4 correctly, the keys beyond F5 stayed broken. I do
not remember anymore how I did that. It seems that, if I start GNU
screen inside PuTTY, the terminal is set into a different mode, and
PuTTY starts sending different key-codes for the F-keys (screen sets
TERM to vt100, which putty seems to notice).
Best regards,
Paul