|
|
|
|
|
by esrh
1297 days ago
|
|
After getting very used to C-w (delete back work) and C-h (delete character backward) on readline, it really bugged me that these aren't default on emacs, even though readline is often advertised as giving emacs muscle memory. I ended up globally remapping C-w and moving the help prefix, C-h to C-x h and making C-h backspace, because i was pressing it incorrectly that often. |
|
Meanwhile, all Control does is convert a normal (capital) character into a control character, which is the term for the ASCII characters below 32 (aka, the space character) by essentially subtracting 64 (which is almost but not quite equivalent to masking out a bit). Notably, @ is 64, so C-@ generates ASCII 0, which is why you see ^@ printed for NUL bytes in many editors (including vim). After @, you get A-Z and then [, \, ], ^, and _.
This is why, if you want to get Escape, you can type C-[, as ESC is 27 and [ is 91. And this is also how C-G becomes that annoying bell, because G is the 7th letter of the alphabet and BEL is 7, And so, C-M is equivalent to pressing Enter, C-J is equivalent to pressing Tab... and C-H is equivalent to pressing Backspace!! Now, there is also a DEL, for the Delete key, which is which is 127. As ASCII is designed for 7-bit, that is the same as -1, so you can type it using C-?, as ? is 63 ;P.
OK, so, one might should then wonder how the hell Emacs even works, if they remapped the character code for Backspace to do something silly like Help... right?! And the answer is kind of "it doesn't", which I find amazing! There is actually a FAQ entry for Emacs "Why does the Backspace key invoke help?" and a related section from its manual on "If DEL fails to delete". (It might even be the solution you came up with isn't the ideal one, so you might want to read these.)
https://www.gnu.org/software/emacs/manual/html_node/efaq/Bac...
https://www.gnu.org/software/emacs/manual/html_node/emacs/DE...