Skip to content

Instantly share code, notes, and snippets.

@emasaka
Created May 20, 2011 02:40
Show Gist options
  • Save emasaka/982248 to your computer and use it in GitHub Desktop.
Save emasaka/982248 to your computer and use it in GitHub Desktop.
(defun visual-sleep-sort (lst)
(save-window-excursion
(let (r)
(with-temp-buffer
(switch-to-buffer (current-buffer))
(dolist (i lst)
(princ (format "%s%d\n" (make-string i ?\ ) i) (current-buffer)) )
(while (> (buffer-size) 0)
(beginning-of-buffer)
(while (not (eobp))
(if (not (looking-at "^[0-9]")) (forward-line)
(push (read (current-buffer)) r)
(kill-word -1) (delete-char 1) ))
(beginning-of-buffer)
(while (not (eobp))
(when (looking-at " ") (delete-char 1))
(forward-line) )
(redisplay)
(sleep-for 1) ))
(reverse r) )))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment