diff options
| author | Thien-Thi Nguyen | 2004-12-16 17:11:15 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2004-12-16 17:11:15 +0000 |
| commit | 8b000fc3b126bf3417b7daa109c08aa8e7bcd3b4 (patch) | |
| tree | 3aff7bb74e06b00708ee5b3dc8dab640b4c29b8f | |
| parent | 32c544b576558829aa80e90063ccf522d5837bd9 (diff) | |
| download | emacs-8b000fc3b126bf3417b7daa109c08aa8e7bcd3b4.tar.gz emacs-8b000fc3b126bf3417b7daa109c08aa8e7bcd3b4.zip | |
(zone): Fix omission bug: Use a self-disabling
one-shot thunk for uniform (error, quit, normal) recovery.
(zone-pgm-random-life): Fix bug:
Recognize empty initial field by lack of "@" chars.
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/play/zone.el | 22 |
2 files changed, 24 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5108650871d..1d9cc171e92 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2004-12-16 Thien-Thi Nguyen <ttn@gnu.org> | ||
| 2 | |||
| 3 | * play/zone.el (zone): Fix omission bug: Use a self-disabling | ||
| 4 | one-shot thunk for uniform (error, quit, normal) recovery. | ||
| 5 | Reported by John Paul Wallington. | ||
| 6 | (zone-pgm-random-life): Fix bug: | ||
| 7 | Recognize empty initial field by lack of "@" chars. | ||
| 8 | |||
| 1 | 2004-12-16 Juri Linkov <juri@jurta.org> | 9 | 2004-12-16 Juri Linkov <juri@jurta.org> |
| 2 | 10 | ||
| 3 | * help.el (function-called-at-point): | 11 | * help.el (function-called-at-point): |
diff --git a/lisp/play/zone.el b/lisp/play/zone.el index b47a287701d..9338834d6da 100644 --- a/lisp/play/zone.el +++ b/lisp/play/zone.el | |||
| @@ -152,8 +152,15 @@ If the element is a function or a list of a function and a number, | |||
| 152 | (set-window-point (selected-window) wp) | 152 | (set-window-point (selected-window) wp) |
| 153 | (sit-for 0 500) | 153 | (sit-for 0 500) |
| 154 | (let ((pgm (elt zone-programs (random (length zone-programs)))) | 154 | (let ((pgm (elt zone-programs (random (length zone-programs)))) |
| 155 | (ct (and f (frame-parameter f 'cursor-type)))) | 155 | (ct (and f (frame-parameter f 'cursor-type))) |
| 156 | (when ct (modify-frame-parameters f '((cursor-type . (bar . 0))))) | 156 | (restore (list '(kill-buffer outbuf)))) |
| 157 | (when ct | ||
| 158 | (modify-frame-parameters f '((cursor-type . (bar . 0)))) | ||
| 159 | (setq restore (cons '(modify-frame-parameters | ||
| 160 | f (list (cons 'cursor-type ct))) | ||
| 161 | restore))) | ||
| 162 | ;; Make `restore' a self-disabling one-shot thunk. | ||
| 163 | (setq restore `(lambda () ,@restore (setq restore nil))) | ||
| 157 | (condition-case nil | 164 | (condition-case nil |
| 158 | (progn | 165 | (progn |
| 159 | (message "Zoning... (%s)" pgm) | 166 | (message "Zoning... (%s)" pgm) |
| @@ -167,14 +174,17 @@ If the element is a function or a list of a function and a number, | |||
| 167 | (zone-call pgm) | 174 | (zone-call pgm) |
| 168 | (message "Zoning...sorry")) | 175 | (message "Zoning...sorry")) |
| 169 | (error | 176 | (error |
| 177 | (funcall restore) | ||
| 170 | (while (not (input-pending-p)) | 178 | (while (not (input-pending-p)) |
| 171 | (message (format "We were zoning when we wrote %s..." pgm)) | 179 | (message (format "We were zoning when we wrote %s..." pgm)) |
| 172 | (sit-for 3) | 180 | (sit-for 3) |
| 173 | (message "...here's hoping we didn't hose your buffer!") | 181 | (message "...here's hoping we didn't hose your buffer!") |
| 174 | (sit-for 3))) | 182 | (sit-for 3))) |
| 175 | (quit (ding) (message "Zoning...sorry"))) | 183 | (quit |
| 176 | (when ct (modify-frame-parameters f (list (cons 'cursor-type ct))))) | 184 | (funcall restore) |
| 177 | (kill-buffer outbuf))) | 185 | (ding) |
| 186 | (message "Zoning...sorry"))) | ||
| 187 | (when restore (funcall restore))))) | ||
| 178 | 188 | ||
| 179 | ;;;; Zone when idle, or not. | 189 | ;;;; Zone when idle, or not. |
| 180 | 190 | ||
| @@ -659,7 +669,7 @@ If nil, `zone-pgm-random-life' chooses a value from 0-3 (inclusive).") | |||
| 659 | (end-of-line 0) | 669 | (end-of-line 0) |
| 660 | (forward-char -10)) | 670 | (forward-char -10)) |
| 661 | (let ((life-patterns (vector | 671 | (let ((life-patterns (vector |
| 662 | (if (and col (re-search-forward "[^ ]" max t)) | 672 | (if (and col (search-forward "@" max t)) |
| 663 | (cons (make-string (length (car col)) 32) col) | 673 | (cons (make-string (length (car col)) 32) col) |
| 664 | (list (mapconcat 'identity | 674 | (list (mapconcat 'identity |
| 665 | (make-list (/ (- rtc 11) 15) | 675 | (make-list (/ (- rtc 11) 15) |