Skip to content

Instantly share code, notes, and snippets.

@snim2
Created November 1, 2009 11:44
Show Gist options
  • Select an option

  • Save snim2/223491 to your computer and use it in GitHub Desktop.

Select an option

Save snim2/223491 to your computer and use it in GitHub Desktop.
Convert tabs to spaces in Emacs
;;; Turn tabs to spaces
(defun tabs-to-spaces (&optional begin end)
"Turn all tabs in a region into four spaces."
(interactive "r")
(save-excursion
(if mark-active
(replace-regexp "\t" " " nil (point) (mark))
(replace-regexp "\t" " " nil (point-min) (point-max))
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment