Zealos707 · 2022-07-05 19:29
Hi all,
Sometimes I don't know why when I am at a beginning of a line and I press tab nothing happens, how can I do for make emacs insert 4 spaces instead of tab ?
MitchellMarquez42 · 2022-07-05 19:37
You can check what function the Tab key is bound to with `C-h k TAB` (control-h k tab)
SlowValue · 2022-07-05 19:41
The shortcut `C-h k <TAB>` will give you an explanation to what is happening, when you press TAB.
`C-q <TAB>` will insert a real TAB character instead. If that is not enough you could rebind TAB via `(global-set-key (kbd "TAB") #'self-insert-command)`, but I do not recommend that (that keybinding may also be overshadowed by some modes).
Axeman12 · 2022-07-05 22:41
Also check the value and help string of the variable `tab-always-indent`.
dpoggio · 2022-07-05 23:19
A bit of generic advice: you can use apropos to search `\btabs?\b` (meaning tab or tabs in a word boundary, mainly to avoid matching “table”) to search info. Helm-Apropos will also give you a hand to search variables matching `\btabs?\b` and `\bindent`. You can also just go to `M-x customize` and search for `tab`, then look into the results for anything like “indent”. You will find about these variables other people mentioned, and about `indent-tabs-mode`. Check that out, but most importantly: take note on how to search for help. BTW: there’s also the manual `C-h i` then go to Emacs and search for “indentation”. There’s a “just spaces” item there. Emacs is self documented.
7890yuiop · 2022-07-06 00:46
* "I press tab **nothing happens**"
* "how can I do for make emacs insert 4 spaces **instead of tab** ?"
Those are two different things, so your question is immediately unclear. Did nothing happen, or was a tab inserted?
Indentation is an (often-unexpectedly) complex topic in Emacs and can be confusing, so please be much more specific about the circumstances in which you are having problems.
At absolute minimum, say which major modes you're talking about, and (without the aforementioned ambiguity) what's actually happening, and what you want to happen instead.
x-skeptic · 2022-07-06 02:58
I found this page simple and helpful: [https://pement.org/emacs\_tabs.htm](https://pement.org/emacs_tabs.htm)
KaranasToll · 2022-07-06 17:41
By default emacs does automatically indentation. Pressing tab means "indent the current properly" (in most major modes). It is on of my favorite things about emacs. It is so tedious to manually format everything.