Normally, for historic reasons, emacs treats the TAB keycode and the C-i key as the same, cf. the emacs lisp documentation on function keys or abo-abo's answer on the question "What is the difference between TAB and ?".

NOTE: In this post, keycodes are TAB, <tab>, and C-i; tab and Ctrl + i on the other hand are the physical keys on the keyboard.

However, at the moment, emacs treats the TAB and C-i as the same thing, i.e. (equal (kbd "TAB") (kbd "C-i")) -> t.

However, since we are no longer living in the stoneage of computing I find this extremely annoying. There's a few suggestions out there what can be done to work around this, e.g.

  • "How do I bind a command to C-i without changing TAB?"

    • Trey's Solution did not work for my, the variable local-function-key-maps is not changed. Modifying it to use delete rather than delq does result in a modified variable but it does not bring resolve ... tab and Ctrl+i are still the same.
    • Translating to the hyper map seems like a 1980s workaround ... I might want to use Hyper+i as well.
  • Using the input-decode-map to map Ctrl+i to some post-ASCII control code is almost what I'm looking for. Except that it does not work properly with the kbd macro meaning that one must modify all bits of source code that will bind Ctrl + i. Arguably this is the best solution given that all source code is modified properly.

  • Using (kbd "<tab>") for tab and (kbd "C-i") (which translates to (kbd "TAB") i.e. the \t literal) for Ctrl+i does work but you'd have to modify all source files which use the wrong kind of tab [Read: the keycode TAB] which is annoying.
    This has been suggested e.g. in a github issue and on emacs.sx as well.

None of these solutions seem real solutions, I'd rather consider them workarounds or hacks (of the existing bug).

Is there a way out there to force emacs to map tab to (kbd "<tab>") and (kbd "TAB") while Ctrl+i is mapped to (kbd "C-i") short of modyfing the emacs source code?

This approach should be completely invisible to the user, meaning that the tab like keycodes <tab> and TAB should map to one binding whilst the Ctrl+i like keycode C-i should map to another binding.

On a less serious note: Any emacs developers here who can comment whether this will be changed / fixed in the emacs source code at some point?

  • 2
    Note that TAB and C-i (the codes, not the keys) are one and the same by definition of TAB.
    – Stefan
    Commented Oct 19, 2015 at 16:36
  • @Stefan That's why I added the Note thing. I'm going to edit the post and put it in there.
    – elemakil
    Commented Oct 19, 2015 at 16:39
  • Possible duplicate of How to bind C-i as different from TAB? Commented Feb 14, 2016 at 0:39
  • 1
    IMO, this question is not a duplicate, because it wants to relocate all keybindings defined on TAB (even those from external packages), to use <tab> instead. While the other question was asking how to differentiate them in your own code.
    – Malabarba
    Commented Feb 14, 2016 at 1:30
  • My suggestion would be to advise kbd to translate TAB as [tab]. It just won't work for the preloaded parts of Emacs.
    – Malabarba
    Commented Feb 14, 2016 at 1:32

1 Answer 1


The future is long gone, and the stone age of computing is just about to come. All text terminals I know still send the exact same byte-sequence to Emacs for C-i as for TAB, so the original need to "unify" them is still very much with us.

The input-decode-map (à la (define-key input-decode-map "\C-i" [C-i])) is probably about as good as it gets right now.

As Emacs ex-maintainer, I'd welcome a better solution to this problem, so as to free up the C-i (and C-m and C-[) keys under GUIs (probably make them "reserved for the user"). But I don't know how to do that without causing lots of problems with existing packages.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.