Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using tabs alone for indentation in Emacs

I love Emacs but don't like how it does indentation: either an uncontrollable mix of tabs-and-spaces or just spaces ((setq indent-tabs-mode nil)).

I want Emacs to do do indentation:

  1. With tabs alone.

  2. Do the indentation to a fixed number of places (not 6 sometimes, 8 other times and 4 in some other places).

  3. Be able to set one level of indentation as being equal to 4 (or 2) spaces.

  4. If I change the value of the tab stop, all newly-opened or reloaded files should use the new value (or can this change be affected only by re-starting Emacs?)

Is all of the above possible? Some settings in .emacs or a package?

Most IDEs (e.g. Eclipse) offer the above.

like image 739
markvgti Avatar asked Dec 09 '22 23:12

markvgti


1 Answers

smart tabs would insert tabs and spaces contextually.

Personally I only use spaces for both indentation and alignment (at least for my own projects). Here is another article on emacswiki I found very useful about the topic

like image 118
kindahero Avatar answered Dec 28 '22 05:12

kindahero