diff options
| author | Chong Yidong | 2007-01-30 19:36:41 +0000 |
|---|---|---|
| committer | Chong Yidong | 2007-01-30 19:36:41 +0000 |
| commit | a5b5e31e1c7d68aa37f96e0628d49d2235d2b952 (patch) | |
| tree | 6fc018a9ea0a2f2e1e6af993cb5faa6dfce583a9 | |
| parent | 9b4837a44446a1256778d873931fcc9c47b0eca6 (diff) | |
| download | emacs-a5b5e31e1c7d68aa37f96e0628d49d2235d2b952.tar.gz emacs-a5b5e31e1c7d68aa37f96e0628d49d2235d2b952.zip | |
(type-break-catch-up-event): New function.
(type-break-demo-hanoi, type-break-demo-life)
(type-break-demo-boring): Use it.
| -rw-r--r-- | lisp/type-break.el | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/type-break.el b/lisp/type-break.el index 98851bcab20..361670dbe6c 100644 --- a/lisp/type-break.el +++ b/lisp/type-break.el | |||
| @@ -1120,6 +1120,13 @@ With optional non-nil ALL, force redisplay of all mode-lines." | |||
| 1120 | 1120 | ||
| 1121 | ;;; Demo wrappers | 1121 | ;;; Demo wrappers |
| 1122 | 1122 | ||
| 1123 | (defun type-break-catch-up-event () | ||
| 1124 | ;; If the last input event is a down-event, read and discard the | ||
| 1125 | ;; corresponding up-event too, to avoid triggering another prompt. | ||
| 1126 | (and (eventp last-input-event) | ||
| 1127 | (memq 'down (event-modifiers last-input-event)) | ||
| 1128 | (read-event))) | ||
| 1129 | |||
| 1123 | ;; This is a wrapper around hanoi that calls it with an arg large enough to | 1130 | ;; This is a wrapper around hanoi that calls it with an arg large enough to |
| 1124 | ;; make the largest discs possible that will fit in the window. | 1131 | ;; make the largest discs possible that will fit in the window. |
| 1125 | ;; Also, clean up the *Hanoi* buffer after we're done. | 1132 | ;; Also, clean up the *Hanoi* buffer after we're done. |
| @@ -1132,9 +1139,11 @@ With optional non-nil ALL, force redisplay of all mode-lines." | |||
| 1132 | (hanoi (/ (window-width) 8)) | 1139 | (hanoi (/ (window-width) 8)) |
| 1133 | ;; Wait for user to come back. | 1140 | ;; Wait for user to come back. |
| 1134 | (read-event) | 1141 | (read-event) |
| 1142 | (type-break-catch-up-event) | ||
| 1135 | (kill-buffer "*Hanoi*")) | 1143 | (kill-buffer "*Hanoi*")) |
| 1136 | (quit | 1144 | (quit |
| 1137 | (read-event) | 1145 | (read-event) |
| 1146 | (type-break-catch-up-event) | ||
| 1138 | (and (get-buffer "*Hanoi*") | 1147 | (and (get-buffer "*Hanoi*") |
| 1139 | (kill-buffer "*Hanoi*"))))) | 1148 | (kill-buffer "*Hanoi*"))))) |
| 1140 | 1149 | ||
| @@ -1153,12 +1162,14 @@ With optional non-nil ALL, force redisplay of all mode-lines." | |||
| 1153 | (life 3) | 1162 | (life 3) |
| 1154 | ;; wait for user to return | 1163 | ;; wait for user to return |
| 1155 | (read-event) | 1164 | (read-event) |
| 1165 | (type-break-catch-up-event) | ||
| 1156 | (kill-buffer "*Life*")) | 1166 | (kill-buffer "*Life*")) |
| 1157 | (life-extinct | 1167 | (life-extinct |
| 1158 | (message "%s" (get 'life-extinct 'error-message)) | 1168 | (message "%s" (get 'life-extinct 'error-message)) |
| 1159 | ;; restart demo | 1169 | ;; restart demo |
| 1160 | (setq continue t)) | 1170 | (setq continue t)) |
| 1161 | (quit | 1171 | (quit |
| 1172 | (type-break-catch-up-event) | ||
| 1162 | (and (get-buffer "*Life*") | 1173 | (and (get-buffer "*Life*") |
| 1163 | (kill-buffer "*Life*"))))))) | 1174 | (kill-buffer "*Life*"))))))) |
| 1164 | 1175 | ||
| @@ -1244,7 +1255,8 @@ With optional non-nil ALL, force redisplay of all mode-lines." | |||
| 1244 | message)))) | 1255 | message)))) |
| 1245 | (goto-char (point-min)) | 1256 | (goto-char (point-min)) |
| 1246 | (sit-for 60)) | 1257 | (sit-for 60)) |
| 1247 | (read-event) | 1258 | (read-event) |
| 1259 | (type-break-catch-up-event) | ||
| 1248 | (kill-buffer buffer-name)) | 1260 | (kill-buffer buffer-name)) |
| 1249 | (quit | 1261 | (quit |
| 1250 | (and (get-buffer buffer-name) | 1262 | (and (get-buffer buffer-name) |