Skip to content

Instantly share code, notes, and snippets.

@fakedrake
Created September 26, 2012 19:34
Show Gist options
  • Save fakedrake/3790068 to your computer and use it in GitHub Desktop.
Save fakedrake/3790068 to your computer and use it in GitHub Desktop.
(defun py-my-indent-region (&optional min max)
"Stupidly clamp indentation to the closest multiple of 4 spaces."
(interactive)
(save-excursion
(let ((top (or min (point-min)))
(bottom (or max (point-max)))
(line-move-visual nil))
(goto-char top)
(while (<= (point) bottom)
(indent-line-to
(* 4 (round (/ (float (current-indentation)) 4))))
(next-line) (end-of-line)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment