Created
October 1, 2009 15:48
-
-
Save hchbaw/199053 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(progn | |
(defun tst () | |
(macrolet ((with-window-testing-buffer (lines &rest body) | |
(let ((gb (gensym))) | |
`(let ((,gb (get-buffer-create "testing"))) | |
(switch-to-buffer ,gb) | |
(erase-buffer) | |
(dotimes (_ ,lines) | |
(insert "a\n")) | |
(unwind-protect | |
(progn ,@body) | |
(kill-buffer ,gb)))))) | |
(with-window-testing-buffer 500 | |
(flet ((line-then (line thunk) | |
(progn | |
(goto-line 1) | |
(sit-for 1) | |
(goto-line line) | |
(funcall thunk)))) | |
(multiple-value-bind (a b) | |
(values | |
(line-then 500 'window-start) | |
(line-then 500 | |
(lambda () | |
(let (r) | |
(run-at-time 0.5 nil | |
(lambda (w) | |
(setq | |
r | |
(window-start w))) | |
(selected-window)) | |
(sit-for 1) | |
r)))) | |
(cons (= a b) (cons a b))))))) | |
(tst)) | |
;;⇒ (nil 1 . 945) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment