[Tutor] emacs and tabs/spaces

"André Walker-Loud <walksloud@gmail.com>" walksloud at gmail.com
Fri Dec 5 04:21:09 CET 2014

Hi All,

I haven’t found an answer yet to this question via google or tutor archives.
For those of you who use emacs as an editor, I have the following problem.
I have edited my .emacs file to have

(add-hook 'python-mode-hook
          (lambda ()
            (setq indent-tabs-mode t)
            (setq tab-width 4)
            (setq python-indent 4)))

which sets my “tab” to 4 spaces.  However, if I have a line that is too long (more than 80 characters), I often break the line in multiple lines and use “tab” to align them, eg.


In this case, the “tab” alignment does not make it an integer number of 4 spaces - so when I try and edit the file on a different machine, with another editor (TextWrangler) that does actually put all tabs to 4 spaces, I end up breaking my files often.

Does anyone know how to get emacs to force “tab” to stay at integer numbers of 4 spaces with these multi-lines?



More information about the Tutor mailing list