Logos
Basically what I've been doing the past couple of weeks is trying to customize my keybinds one mode at a time; thus I've been going through each mode one-by-one and completely clearing its keymap individually. And then binding the functions that I find useful.
I'm also doing this for educational purposes to learn more about the inner-workings of keymaps, how they relate, how to manipulate them, etc.
But what has me stuck, is how some keys (or functions
/macros
; I'm not sure what they should be called) are defined. For example <backtab>
, <C-return>
, <C-tab>
, <C-iso-lefttab>
, etc.
I have unbound every function key in both function-key-map
and local-function-map
using the command: (setf (cdr <keymap>) nil)
But yet these keys still seem to persist in existence.
Perhaps I'm just confusing myself by trying to wrap my head around the multiple levels of abstraction all at the same time..
Question
So how would I completely obliterate these keys, so that I can start from first principles and create them myself (with their own custom names and functionality)?
Bonus Question
Why is it
(define-key input-decode-map [?\C-i] (kbd "<C-i>"))
creates an abstraction that interprets the keys C-i
and <C-i>
differently?Control+i ==
C-i
== ^I
== TAB
Control+i ==
<C-i>
!= TAB
Does this perhaps have something to do with the paradigm shift of my thinking that needs to happen in order to better understand keymaps?
I think it would really help me and people in the future if someone could make a trivial and complex example in a format like this (assuming current major mode is
text-mode
):
keypress Control+Backspace ->
local-function-keymap Control+Backspace=<C-backspace>
->
text-mode-map <C-backspace>
=nil
->
global-map <C-backspace>
=backward-kill-word
UPDATE
I found that you can (kind of) obliterate the functions and then rebind them to their corresponding ASCII keys like so:
(setf (cdr x-alternatives-map) nil)
(setf (cdr function-key-map) nil)
(setf (cdr local-function-key-map) nil)
(define-key local-function-key-map (kbd "<tab>") [9])
(define-key local-function-key-map (kbd "<return>") [13])
(define-key local-function-key-map (kbd "<escape>") [27])
(define-key local-function-key-map (kbd "<backspace>") [127])
But even if I never rebind the keys, for some reason unbeknownst to me, the modifiers of the keys still work. So is there a keymap that I'm just not aware of?
if <tab> = undefined
C-<tab> = defined
x-alternatives-map
andkey-translation-map
andinput-decode-map
but I can't figure out where backtab's definition comes from…keyboard.c
source file. Therefore there is no way to completely obliterate them.