When editing a plain-text document in Text mode when I press tab emacs inserts spaces until the cursor appears directly beneath the beginning of a word it finds in the line above.

I don't want it to do this. What I want is for the tab key to columnise the cursor position and therefore to align the cursor with the next preset tab-stop, ignoring text in the preceding line, much as a conventional mechanical manual typewriter does.

What setting do I need to change for tab to behave like a conventional manual typewriter in Text mode?

  • This question might be a duplicate - maybe someone can find that. (There are lots of hits when I search for tab-to-tab-stop, but a quick check didn't find a good dup.)
    – Drew
    Commented Aug 24, 2020 at 18:11
  • I also looked first, and didn't find a duplicate. I wouldn't have thought to search for "tab-to-tab-stop". If there is a duplicate then neither you nor I found it, even after looking. Commented Aug 24, 2020 at 18:14
  • Thanks for checking.
    – Drew
    Commented Aug 24, 2020 at 18:26

1 Answer 1


What TAB does now is indent-for-tab-command. What you want is tab-to-tab-stop. The latter is available at M-i, so one option is to learn to use that.

To always bind TAB to run that command in Text mode, you can put

(add-hook 'text-mode-hook
          (lambda ()
            (define-key text-mode-map "\t" 'tab-to-tab-stop)))

in your init file.

  • 1
    +1 for the explanation. But no need for the hook addition. Just (define-key ...) is sufficient.
    – Drew
    Commented Aug 24, 2020 at 18:03
  • @pst, thanks. M-i is the definitely the behaviour I described. Thank you for the additional information too. Commented Aug 24, 2020 at 18:38

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.