diff options
| author | Chong Yidong | 2007-01-28 19:40:31 +0000 |
|---|---|---|
| committer | Chong Yidong | 2007-01-28 19:40:31 +0000 |
| commit | d33ca4d437218a26d9d85428b7046df19149535e (patch) | |
| tree | ad0456a09a99b51ca4c93b6aeaef742c6595f79e | |
| parent | d46b940851f2529a1ffd1cd198db2b158aa19b37 (diff) | |
| download | emacs-d33ca4d437218a26d9d85428b7046df19149535e.tar.gz emacs-d33ca4d437218a26d9d85428b7046df19149535e.zip | |
(gamegrid-kill-timer): Cancel timer directly.
(gamegrid-add-score-with-update-game-score-1): Allow local quits
when calling update-game-score program. Remove unnecessary
save-excursion.
| -rw-r--r-- | lisp/play/gamegrid.el | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el index 41f04ea27cb..1a2b8c31ef4 100644 --- a/lisp/play/gamegrid.el +++ b/lisp/play/gamegrid.el | |||
| @@ -420,7 +420,7 @@ static unsigned char gamegrid_bits[] = { | |||
| 420 | (if gamegrid-timer | 420 | (if gamegrid-timer |
| 421 | (if (featurep 'itimer) | 421 | (if (featurep 'itimer) |
| 422 | (delete-itimer gamegrid-timer) | 422 | (delete-itimer gamegrid-timer) |
| 423 | (timer-set-time gamegrid-timer '(0 0 0) nil))) | 423 | (cancel-timer gamegrid-timer))) |
| 424 | (setq gamegrid-timer nil)) | 424 | (setq gamegrid-timer nil)) |
| 425 | 425 | ||
| 426 | ;; ;;;;;;;;;;;;;;; high score functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 426 | ;; ;;;;;;;;;;;;;;; high score functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| @@ -515,41 +515,42 @@ FILE is created there." | |||
| 515 | (defun gamegrid-add-score-with-update-game-score-1 (file target score) | 515 | (defun gamegrid-add-score-with-update-game-score-1 (file target score) |
| 516 | (let ((default-directory "/") | 516 | (let ((default-directory "/") |
| 517 | (errbuf (generate-new-buffer " *update-game-score loss*"))) | 517 | (errbuf (generate-new-buffer " *update-game-score loss*"))) |
| 518 | (apply | 518 | ;; This can be called from a timer, so enable local quits. |
| 519 | 'call-process | 519 | (with-local-quit |
| 520 | (append | 520 | (apply |
| 521 | (list | 521 | 'call-process |
| 522 | (expand-file-name "update-game-score" exec-directory) | 522 | (append |
| 523 | nil errbuf nil | 523 | (list |
| 524 | "-m" (int-to-string gamegrid-score-file-length) | 524 | (expand-file-name "update-game-score" exec-directory) |
| 525 | "-d" (if gamegrid-shared-game-dir | 525 | nil errbuf nil |
| 526 | (expand-file-name shared-game-score-directory) | 526 | "-m" (int-to-string gamegrid-score-file-length) |
| 527 | (file-name-directory target)) | 527 | "-d" (if gamegrid-shared-game-dir |
| 528 | file | 528 | (expand-file-name shared-game-score-directory) |
| 529 | (int-to-string score) | 529 | (file-name-directory target)) |
| 530 | (concat | 530 | file |
| 531 | (user-full-name) | 531 | (int-to-string score) |
| 532 | " <" | 532 | (concat |
| 533 | (cond ((fboundp 'user-mail-address) | 533 | (user-full-name) |
| 534 | (user-mail-address)) | 534 | " <" |
| 535 | ((boundp 'user-mail-address) | 535 | (cond ((fboundp 'user-mail-address) |
| 536 | user-mail-address) | 536 | (user-mail-address)) |
| 537 | (t "")) | 537 | ((boundp 'user-mail-address) |
| 538 | "> " | 538 | user-mail-address) |
| 539 | (current-time-string))))) | 539 | (t "")) |
| 540 | "> " | ||
| 541 | (current-time-string)))))) | ||
| 540 | (if (buffer-modified-p errbuf) | 542 | (if (buffer-modified-p errbuf) |
| 541 | (progn | 543 | (progn |
| 542 | (display-buffer errbuf) | 544 | (display-buffer errbuf) |
| 543 | (error "Failed to update game score file")) | 545 | (error "Failed to update game score file")) |
| 544 | (kill-buffer errbuf)) | 546 | (kill-buffer errbuf)) |
| 545 | (save-excursion | 547 | (let ((buf (find-buffer-visiting target))) |
| 546 | (let ((buf (find-buffer-visiting target))) | 548 | (if buf |
| 547 | (if buf | 549 | (progn |
| 548 | (progn | 550 | (with-current-buffer buf |
| 549 | (with-current-buffer buf | 551 | (revert-buffer nil t nil)) |
| 550 | (revert-buffer nil t nil)) | 552 | (display-buffer buf)) |
| 551 | (display-buffer buf)) | 553 | (find-file-read-only-other-window target))))) |
| 552 | (find-file-read-only-other-window target)))))) | ||
| 553 | 554 | ||
| 554 | (defun gamegrid-add-score-insecure (file score &optional directory) | 555 | (defun gamegrid-add-score-insecure (file score &optional directory) |
| 555 | (save-excursion | 556 | (save-excursion |