What's the name of that feature that auto indent the code when I press tab (Even fi the indentation is more to the right, the tab "erases" the abundany spaces) and how can I change the size of it?

  • 1
    C-h k [tab] will tell you what command [tab] calls.
    – Dan
    Jun 19, 2016 at 19:58
  • It can vary by the major (or minor) modes in use. Without knowing which major mode you're using, we can't say anything more than what Dan has mentioned (which in the case of TAB will tend to be the first of several indirect steps to find out the command which is actually being called...)
    – phils
    Jun 19, 2016 at 22:43

1 Answer 1


As said in comments, the behaviour of tab changes often depending on the mode you are using.

I suggest you read more how the indentation works in Emacs in the wiki

Main variables are:

  • c-basic-offset: The basic indentation offset in CC Mode, default is 2. For Perl, it is controlled by cperl-indent-level.

  • tab-width: How wide a tab is, default is 8.

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.