I'm running Arch linux and I'd like to use emacs from one of my tty terminals, but there's a bit of a problem: for some reason the capslock key is not interpreted as a backspace directly, but as <Ctrl>+H, so on the terminal and other readline-consistent programs it works completely fine. But if I hit the capslock-backspace key inside of emacs, I get a wonderful help dialog for whatever I type next. I know Shai is a vi user, so maybe this never came up, but I'd like to think that there is a simple work-around/fix available or something. When I'm using X11, the keymapping works just fine, no problems with <Ctrl>+H or anything else except the usual xset r 66 routine, so maybe there is something to be done in the implementation for the linux console w/o gui.
I know that for fixing Vim issues in the console with Ctrl+H/Ctrl+S/Ctrl+Q I used the following commands:
export TERM=xterm # make Backspace and Ctrl-H work correctly stty -ixon -ixoff # make Ctrl+S and Ctrl+Q work correctly
Thanks for the quick response. I tried those 2 fixes, and I still have the same result. I'm thinking that the problem is that the keycode for the CapsLock key is bound to the character ^H. I could change emacs's behavior to change the help dialog to some other key combo, but I think that this behavoir is not limited to emacs. I don't know all that much about working with keymappings/keybindings etc. on a plain old terminal so I'm a little stuck at the moment. But I'll keep doing some research.
I think that the ideal solution for me would be to let the CapsLock keycode be interpreted exactly like the backspace keycode is. I'm not going to say this is the best way to go for the colemak layout, but if someone could point me to some information on configuring this type of thing on a plain terminal I'd be very greatful; google doesn't always order results based on usefulness;). Honestly I had been using Ubuntu until recently and I never had this problem; probably something they did to the tty terminals.
Update: the problem is exactly that the CapsLock keycode is interpreted as <Ctrl>+H. Found this out by trying to use the CapsLock-backspace while typing in a terminal while a program was not expecting any input. I looked at the .kmap file in colemak-1.0/linux_console directory and I see the entry for keycode 58 (I'm assuming this is the CapsLock key), and it looks like the file is telling the system to interpret it as a backspace for all levels, so why <Ctrl>+H is used, I don't know. If I find out anything more in between responses I'll post it here.
The third paragraph about ^H. I'm not sure how it'll help you, but maybe it might bring you a little closer to the truth, or something. :)
EDIT: This seems to be more of a general problem, actually.
From http://www.linuxquestions.org/questions … ins-33272/ :
Right, the terminal accepts two commands as a "backspace", ^H or ^?. Emacs only accepts one. You can check which one emacs uses by hitting Ctrl-H or Ctrl-? while in emacs. One of them should act as a backspace. Use tset to set that command to be the backspace while you are logged in to the remote machine (that is, on the remote machine, run, for example, "tset -e ^H" ).
I had a similar problem where Perl would not accept the ^H (which is what the backspace key sends) as an erase character, but I could use the backspace key normally for most other uses. Using "tset -e ^H" solved that.
i had the same problem (backspace key works for the terminal session but not for emacs) and the tset -e fix didn't work for me, but I found a different workaround.
Adding this line to my .emacs, backspace does what it should w/in emacs:
(global-set-key "\C-h" 'backward-delete-char)
Anyway, hope that helps if there's anyone out there who ran into the same problem.
If, as mentioned in the post above, your backspace key is sending Ctl-?, rewrite the line as:
(global-set-key "\C-?" 'backward-delete-char)
see what emacs says when you type backspace within it; that should give a clue to how your terminal is set up. whatever combination of keys emacs "receives" when you hit backspace (in my case control-h), map that to backward-delete-char and from then on backspace will behave properly in emacs.
Here's what I use:
(defun fix-backspace () "Map control-h to work as backspace" (interactive) (keyboard-translate ?\C-h ?\C-?) (global-set-key [(hyper h)] 'help-command))
This maps C-h to whatever C-? was already mapped to, so it plays nice with other customizations, and it gives you a new binding for help. Since some terminals give me trouble and some don't, I like having this as a callable command, rather than making it automatic.
Std. disclaimer: I don't think this was originally my idea, but I don't know where I got it from.
Aaaand there's a lot more, both on that link and with a simple google query. Amazing.
Last edited by kqr (27-Apr-2010 05:55:57)
Current Colemak: http://hi-games.net/typing-test,60/watch?u=1388
Eureka! I've found the solution, and it's (in my case) a bit of a bug in the colemak-1.0/linux_console/colemak.iso15.kmap file. The "keycode 58" line has it's entries as "BackSpace", but in order for the capslock key to be a true backspace, it needs to have instead "Delete" entries, just like the "keycode 14" entry, which is the original backspace key. So, with that change the layout is (at far as I know) working flawlessly on tty terminals.
I'd recommend adding that change to the official implementation, as I don't think it was intentional to have capslock-backspace act any differently than the original backspace key. Hopefully this will help someone else who dares to try the colemak layout :)