Created
May 29, 2014 00:29
-
-
Save ajchemist/b61ef6a395df7b0b48c3 to your computer and use it in GitHub Desktop.
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
(defun winnum-select (&optional num) | |
"Selects the nth window." | |
(interactive (list (let (_) | |
(while (or (not (characterp _)) | |
(<= _ 48) ; 0 not included | |
(and (> _ 57) (< _ 97)) | |
(> _ 122)) | |
(setq _ (read-event | |
#("Switch to Winnum: " 0 18 | |
(face minibuffer-prompt))))) | |
(cond ((> _ 96) (setq _ (- _ 87))) | |
(t (setq _ (- _ 48)))) | |
_))) | |
(let ((window (nth (1- num) (winnum-list)))) | |
(if (and window (or (not (window-minibuffer-p window)) | |
(minibuffer-window-active-p window))) | |
(select-window window) | |
(error "No such window.")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment