I've just set

(define-key input-decode-map "\C-i" [\C-i])
(define-key input-decode-map "\C-m" [\C-m])
(define-key input-decode-map "\C-[" [\C-\[])

in my config, but I noticed that C-i is now remapped to <C-i>.

Where is the difference? It's possible to obtain only C-i?

I'm interested in getting a C-i not a \t or a <C-i>

  • Perhaps you meant [?\C-i], aka (control ?i)? – Drew Nov 20 '18 at 14:47
  • I also don't know the difference between "\C-i" and "?\C-i" – Francesco Cadei Nov 20 '18 at 15:06
  • 2
    Spontaneously, I don't understand the purpose of the lines. They seem to map some keys to themselves, why do you need them? – Lindydancer Nov 20 '18 at 16:35
  • 1
    @FrancescoCadei: In Elisp, characters are represented specially. For more information, look at GNU Emacs Lisp Reference Manual. For instance, a newline character may be represented by ?\n, ?\C-j, ?\^j, etc. – Fólkvangr Nov 20 '18 at 18:34
  • 2
    @FrancescoCadei: you can also formulate the problem by specifying the result you want to obtain, c.f. Lyndydancer's comment. – Fólkvangr Nov 20 '18 at 20:16

I'm interested in getting a C-i not a \t

C-i and \t are the same thing (ASCII character 9).

If you want the TAB key to be different to C-i you can achieve that in a GUI environment (but not in a terminal, where they are, again, the same thing).

In GUI environments, the event <tab> is sent to Emacs when the TAB key is used.

function-key-map maps <tab> to TAB (aka C-i, aka 9) so that in a GUI environment the TAB key will do the same thing that it does in a terminal.

(lookup-key function-key-map (kbd "<tab>"))

If you want to 'expose' the <tab> event, you'll want to remove that binding:

(define-key function-key-map (kbd "<tab>") nil)

Note that most things with a tab binding will be using the terminal-friendly value, so expect some things to stop working if you remove this mapping.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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