Reputation: 2067
I am unable to get emacs version 24.3 to indent two whitespaces when I hit the tab key in fundamental mode. I've read a number of other posts, such as set 4 Space Indent in Emacs. I'm pretty sure this used to work in older emacs versions:
(setq tab-width 2)
(setq indent-tabs-mode nil)
I'm now trying all this:
(setq tab-width 2)
(setq-default tab-width 2)
(setq indent-tabs-mode nil)
(setq-default indent-tabs-mode nil)
(setq indent-line-function 'insert-tab)
(setq tab-stop-list (number-sequence 2 400 2))
Now I find that tab is indenting to go right after the first white space block in the line
this is my first line
second line starts here
I can't figure out how to get it to simple to
this is my first line
second line starts here
Maybe the problem is my configuration? I have installed this new version of emacs in my own user home directory - it is not system wide version of emacs.
Upvotes: 2
Views: 875
Reputation: 28601
The first thing to do if you want to change the behavior "when I hit " is to do C-h k <foo>
. That will tell you which command is run, and might give you some further hints about how to change its behavior. The behavior of the TAB key depends on the major mode, so making it do what you want depends on the major mode you're using. If you're using fundamental-mode
, you'renot using Emacs in the normal way, so I'd recommend you try and fix that first.
Upvotes: 0
Reputation: 73365
Actually, your "I'm now trying all this" config works just fine:
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq indent-line-function 'insert-tab)
(setq tab-stop-list (number-sequence 2 400 2))
If you reduce your init file to this, it should work as desired.
You may be clobbering the settings elsewhere in your config?
Upvotes: 2