Jules
Jules

Reputation: 14510

Forcing emacs to use the tab character instead of a number of spaces

I recently ran into some trouble with cron and crontab because the text editor I use, emacs, inserts several spaces instead of a tab, when I press the tab key. This issue persists throughout all the major modes, regardless of the tab width set for each mode.

How can emacs be forced to use the tab character instead of tabs composed of multiple spaces?

Upvotes: 3

Views: 1069

Answers (2)

Stefan
Stefan

Reputation: 28531

If you want to insert a TAB character, then use C-q TAB. The TAB key is used for a different purpose (mostly to indent/align text/code according to various rules, tho it's also used for various other purposes such as performing completion, skipping from one field to another, etc...).

Upvotes: 2

ajk
ajk

Reputation: 1055

Set the variable indent-tabs-mode. You can do that by customizing the variable with M-x customize-variable, on the fly with M-x set-variable, or in Elisp with the setq function.

Upvotes: 1

Related Questions