Last active
December 10, 2015 20:58
-
-
Save thefloweringash/4491576 to your computer and use it in GitHub Desktop.
Testing indent-to with indent-tabs-mode
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
(require 'cl) | |
(whitespace-mode t) | |
(setq indent-tabs-mode t | |
tab-width 4) | |
(defun indent-to-test--run (start end) | |
(interactive "r") | |
(undo-boundary) | |
(flet ((undo-boundary () nil)) | |
(let ((off 0) | |
(end-m (copy-marker end))) | |
(goto-char start) | |
(while (< (point) (marker-position end-m)) | |
(beginning-of-line) | |
(cond ((search-forward-regexp "!" (point-at-eol) t) | |
(goto-char (match-beginning 0)) | |
(let ((target (incf off)) | |
(returned (indent-to off)) | |
(actual (current-column))) | |
(sit-for 0.2) | |
(end-of-line) | |
(indent-to 50) | |
(insert (format "(indent-to %i) => %i, (current-column) => %i" | |
target returned actual)))) | |
(t (setq off 0))) | |
(forward-line))))) | |
a!a | |
a!a | |
a!a | |
a!a | |
a!a | |
a!a | |
a!a | |
a!a | |
a!a | |
a !a | |
a !a | |
a !a | |
a !a | |
a !a | |
a !a | |
a !a | |
a !a | |
aa !a | |
aa !a | |
aa !a | |
aa !a | |
aa !a | |
aa !a | |
aa !a | |
aa !a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment