Skip to content

Instantly share code, notes, and snippets.

@thefloweringash
Last active December 10, 2015 20:58
Show Gist options
  • Save thefloweringash/4491576 to your computer and use it in GitHub Desktop.
Save thefloweringash/4491576 to your computer and use it in GitHub Desktop.
Testing indent-to with indent-tabs-mode
(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