Created
September 30, 2010 00:49
-
-
Save bowbow99/603832 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
| ;;; C-u <key> で現在のウィンドウを登録しておいて、<key> でそのウィンドウに | |
| ;;; 移動する。 | |
| ;;; ※プレフィックスキーは無視されちゃう([C-x 1] と [C-c 1] はどっちも [1] | |
| ;;; 扱いになる)。 | |
| (let ((table (make-hash-table))) | |
| (defun switch-to-registered-window (&optional arg) | |
| (interactive "P") | |
| (if arg | |
| (progn | |
| (setf (gethash *last-command-char* table) (selected-window)) | |
| (message "Window registered for [~A]" *last-command-char*)) | |
| (let ((win (gethash *last-command-char* table))) | |
| (if (windowp win) | |
| (handler-case | |
| (set-window win) | |
| (program-error (e) | |
| (message "Error: Window is deleted."))) | |
| (message "Window not registered for [~A]" *last-command-char*)))))) | |
| ;; 使用例: | |
| ;; C-c [1, 2, .. 0] で使う | |
| (require :cmu_loop) | |
| (loop for i from 48 to 57 ; #\0..#\9 | |
| do (define-key spec-map (code-char i) 'switch-to-registered-window)) | |
| ;; cmu_loop 使いたくない人用 | |
| (let ((i 48)) ; #\0 | |
| (while (<= i 57) ; #\9 | |
| (define-key spec-map (code-char i) 'switch-to-registered-window) | |
| (incf i))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment