M***-F***ing emacs + screen

jjore on 2007-04-05T23:07:42

I just noticed that I couldn't use emacs from within screen at work. Whenever I pressed control-H to open a help screen, emacs would delete a character. This is not the normal operation. It turns out that both my terminfo and /etc/screenrc were "broken" by someone else who thought they were being useful. Idiots.

Here's how I fixed stuff so delete means \e[3~, backspace means ^? and ^H means ^H. The output of "tput kbs | od" was 010 (^H in octal), not 177 (^? in octal). To correct this, I altered my terminfo database.

Translate the local termcap info into terminfo source with captoinfo (or alegedly, "tic -I").

captoinfo -e screen > ~/.terminfo/s/screen.ti


Edit the file so the kbs entry refers to ^? instead of ^H. Compile it with tic and you should have a new ~/.terminfo/s/screen. Terminfo applications seem to just use the file automatically so there's no additional configuration needed.

tic ~/.terminfo/s/screen.ti


I had to also unbreak my /etc/screenrc. I don't know why it was set this way but someone put a comment in there next to the broken setting when they changed it that implied that they thought ^H was the "proper" setting.

This line is an empty definition for the kb termcap entry and it unsets the badness.

# ~/.screenrc
bindkey -d -k kb


^H

bart on 2007-04-06T19:55:23

Ctrl-H is also the ASCII code of backspace (chr(8)). I don't know if pressing ctrl-H does the same as pressing backspace on your system, but I'm sure that's the reason.

Re:^H

jjore on 2007-04-06T21:56:53

Yes, I'm aware there's some history where ^H means backspace but that doesn't seem to be appropriate on any system I'm using these days. I'm not sure that any typical emacs using OS should be redefining ^H away.

I don't really know the history on this. I'm sure it all goes back to some glass terminals and who was more popular in a particular year.