;; Window random action test. (defun random-entry (entries) (let ((size (length entries))) (if (= 1 size) (car entries) (nth (abs (% (random) (length entries))) entries)))) (defun window-test () (interactive) (let ((conf (current-window-configuration)) (file-list (directory-files "/etc" t "\\.conf$"))) (while t (let ((action (abs (% (random) 11)))) (cond ((zerop action) (and (< 16 (window-height)) (split-window-vertically))) ((= 1 action) (and (< 16 (window-width)) (split-window-horizontally))) ((= 2 action) (and (< 1 (count-windows)) (delete-window))) ((= 3 action) (balance-windows)) ((= 4 action) (delete-other-windows)) ((= 5 action) (select-window (random-entry (window-list)))) ((= 6 action) (let ((file (random-entry file-list))) (and (file-readable-p file) (find-file file)))) ((= 7 action) (kill-buffer)) ((= 8 action) (setq conf (current-window-configuration))) ((= 9 action) (set-window-configuration conf)) ((= 10 action) (mapcar 'kill-buffer (buffer-list)))) (sit-for 0.2)))))