summaryrefslogtreecommitdiff
path: root/lisp/type-break.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2007-01-30 19:36:41 +0000
committerChong Yidong <cyd@stupidchicken.com>2007-01-30 19:36:41 +0000
commita5b5e31e1c7d68aa37f96e0628d49d2235d2b952 (patch)
tree6fc018a9ea0a2f2e1e6af993cb5faa6dfce583a9 /lisp/type-break.el
parent9b4837a44446a1256778d873931fcc9c47b0eca6 (diff)
downloademacs-a5b5e31e1c7d68aa37f96e0628d49d2235d2b952.tar.gz
(type-break-catch-up-event): New function.
(type-break-demo-hanoi, type-break-demo-life) (type-break-demo-boring): Use it.
Diffstat (limited to 'lisp/type-break.el')
-rw-r--r--lisp/type-break.el14
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."
;;; Demo wrappers
+(defun type-break-catch-up-event ()
+ ;; If the last input event is a down-event, read and discard the
+ ;; corresponding up-event too, to avoid triggering another prompt.
+ (and (eventp last-input-event)
+ (memq 'down (event-modifiers last-input-event))
+ (read-event)))
+
;; This is a wrapper around hanoi that calls it with an arg large enough to
;; make the largest discs possible that will fit in the window.
;; 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."
(hanoi (/ (window-width) 8))
;; Wait for user to come back.
(read-event)
+ (type-break-catch-up-event)
(kill-buffer "*Hanoi*"))
(quit
(read-event)
+ (type-break-catch-up-event)
(and (get-buffer "*Hanoi*")
(kill-buffer "*Hanoi*")))))
@@ -1153,12 +1162,14 @@ With optional non-nil ALL, force redisplay of all mode-lines."
(life 3)
;; wait for user to return
(read-event)
+ (type-break-catch-up-event)
(kill-buffer "*Life*"))
(life-extinct
(message "%s" (get 'life-extinct 'error-message))
;; restart demo
(setq continue t))
(quit
+ (type-break-catch-up-event)
(and (get-buffer "*Life*")
(kill-buffer "*Life*")))))))
@@ -1244,7 +1255,8 @@ With optional non-nil ALL, force redisplay of all mode-lines."
message))))
(goto-char (point-min))
(sit-for 60))
- (read-event)
+ (read-event)
+ (type-break-catch-up-event)
(kill-buffer buffer-name))
(quit
(and (get-buffer buffer-name)