Emacs - fixed tab width

Go To StackoverFlow.com


I'm editing a text-document styled on its own way of which Emacs doesn't recognize the markup, and opens it in fundamental-mode. Tab indentation is the most problematic behaviour.

Can I fix tab width with a runtime command, only for the current session?

Particularly I'd avoid any permanent in-file configuration.

2012-04-04 01:33
by davide
Also, when you say you wish to avoid in-file configuration, do you only mean the document file you are editing, or does that include your own Emacs configuration as well? (the latter could be made to automatically configure behaviour for a specified file without changing the default behaviour) - phils 2012-04-04 01:44
That will change the displayed width of tabs, but do note that it has no bearing on what happens when you type a tab. Fundamental mode uses indent-relative which moves point to align with the contents of the previous line, and uses the tab-stop-list variable otherwise - phils 2012-04-04 03:04


You can use M-x set-variable to set variables at runtime and only for that buffer and session, ideally you can set the offset variable (for instance in c-common-mode it's c-basic-offset) and you can change this value to the desired tab width (although I recommend you use spaces instead of tabs for consistency as tab characters \t are usually 8 spaces wide.

2012-04-04 01:37
by Jesus Ramos