Created
December 28, 2010 06:47
-
-
Save bowbow99/756971 to your computer and use it in GitHub Desktop.
#xyzzy のコマンドループっぽいもの(作りかけ
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
| (defun command-loop (keymap) | |
| (let (*this-command* | |
| *last-command* | |
| *last-command-char* | |
| (keymap* keymap) | |
| prefixes) | |
| (loop | |
| (refresh-screen) | |
| (setf *last-command-char* (read-char *keyboard*) | |
| *this-command* (lookup-keymap keymap* *last-command-char*)) | |
| (cond ((commandp *this-command*) | |
| (format t "~&Command: ~S~%" *this-command*) | |
| (unwind-protect | |
| (call-interactively *this-command*) | |
| (setf *last-command* *this-command* | |
| prefixes nil | |
| keymap* keymap) | |
| (clear-message))) | |
| ((keymapp *this-command*) | |
| (format t "~&Prefix: ~S~&" *this-command*) | |
| (message "~{~S~^ ~}" (push *last-command-char* prefixes)) ;逆じゃね? | |
| (setf keymap* *this-command*)) | |
| (t | |
| (format t "~&unboud key: ~C~%" *last-command-char*) | |
| ;(error "What? ~S" *this-command*) | |
| ))))) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
universal-argumentあたりが上手く動かない。universal-argumentから呼ばれてるprocess-prefix-argsで(C-u 1 2 3 とかを処理するのに(read-char *keyboard*)した後)set-next-prefix-argsしてるのだけど、これはcall-interactivelyには効かないっぽい。