Help! Indenting craziness!

Jeff Sandys sandysj at asme.org
Tue Jul 11 10:51:06 EDT 2000


Adam Clark wrote:
> 
> Let me retract the "blank, unindented lines" part before somebody flames
> me.  I realize now that this is a python-mode issue, probably due to a
> space/tab mixup.  Problem is, everything appears to be tabs.  There is
> no detectable difference either visually or by cursor navigation between
> correct code and SyntaxError-generating code.
> 
> So, that said, help!!
>

;;; Add this to your .emacs or evaluate it with Meta-:

(setq indent-tabs-mode nil)

;;; I also use a four space tab

(setq default-tab-width 4)


;;; You can fix a file with untabify

;    esc  <
;    ctrl-space
;    esc  >
;    meta-x untabify
;    [save file]


;;; The above .emacs stuff can be put into a procedure like this

(defun python-initialise ()
  (interactive)
  (setq default-tab-width 4)
  (setq indent-tabs-mode nil))

(add-hook python-mode-hook 'python-initialise)

;;; Thanks to Harry George for fixing this for me,
;;; Jeff Sandys



More information about the Python-list mailing list