Created
December 12, 2009 21:37
-
-
Save snim2/255084 to your computer and use it in GitHub Desktop.
Convert spaces to tabs in Emacs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun four-spaces-to-tab (&optional begin end) | |
"Replace four spaces with a tab in a region." | |
(interactive "r") | |
(save-excursion | |
(if mark-active | |
(replace-regexp " " "\t" nil (point) (mark)) | |
(replace-regexp " " "\t" nil (point-min) (point-max)) | |
) | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun eight-spaces-to-tab (&optional begin end) | |
"Replace eight spaces with a tab in a region." | |
(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