I'm an amateur in Emacs and I would like to change TAB with C-q TAB. I used the code:

(define-key key-translation-map (kbd "TAB") (kbd"C-q TAB"))

But by doing so, I need to press TAB twice in order to get a indent and under the screen it shows C-q TAB TAB.

Why would this happen? How can I get the indent only by pressing TAB once?

  • 3
    What is it that you are really trying to do? If you want TAB to just insert a TAB character then bind TAB to self-insert-command. But be aware that various modes bind TAB in other ways, so you may need to either bind it to what you want in those modes or define a minor mode where you bind it to what you want, and then turn on that minor mode.
    – Drew
    Nov 18, 2016 at 0:34
  • @Drew that's what I want. Can you tell me how to achieve it exactly?
    – user14018
    Nov 18, 2016 at 1:59
  • Then the answer you want is here. And really this question should probably be closed as a duplicate of that one (or nearly duplicate - at least that answer is what you're looking for).
    – Drew
    Nov 18, 2016 at 3:01