changeset 75483:4b3089985bc1

(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.
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 28 Jan 2007 19:40:31 +0000
parents d08d2bb89f98
children f1fe767eedcb
files lisp/play/gamegrid.el
diffstat 1 files changed, 32 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/play/gamegrid.el	Sun Jan 28 19:39:58 2007 +0000
+++ b/lisp/play/gamegrid.el	Sun Jan 28 19:40:31 2007 +0000
@@ -420,7 +420,7 @@
   (if gamegrid-timer
       (if (featurep 'itimer)
           (delete-itimer gamegrid-timer)
-        (timer-set-time gamegrid-timer '(0 0 0) nil)))
+        (cancel-timer gamegrid-timer)))
   (setq gamegrid-timer nil))
 
 ;; ;;;;;;;;;;;;;;; high score functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -515,41 +515,42 @@
 (defun gamegrid-add-score-with-update-game-score-1 (file target score)
   (let ((default-directory "/")
 	(errbuf (generate-new-buffer " *update-game-score loss*")))
-    (apply
-     'call-process
-     (append
-      (list
-       (expand-file-name "update-game-score" exec-directory)
-       nil errbuf nil
-       "-m" (int-to-string gamegrid-score-file-length)
-       "-d" (if gamegrid-shared-game-dir
-		(expand-file-name shared-game-score-directory)
-	      (file-name-directory target))
-       file
-       (int-to-string score)
-       (concat
-	(user-full-name)
-	" <"
-	(cond ((fboundp 'user-mail-address)
-	       (user-mail-address))
-	      ((boundp 'user-mail-address)
-	       user-mail-address)
-	      (t ""))
-	">  "
-	(current-time-string)))))
+    ;; This can be called from a timer, so enable local quits.
+    (with-local-quit
+      (apply
+       'call-process
+       (append
+	(list
+	 (expand-file-name "update-game-score" exec-directory)
+	 nil errbuf nil
+	 "-m" (int-to-string gamegrid-score-file-length)
+	 "-d" (if gamegrid-shared-game-dir
+		  (expand-file-name shared-game-score-directory)
+		(file-name-directory target))
+	 file
+	 (int-to-string score)
+	 (concat
+	  (user-full-name)
+	  " <"
+	  (cond ((fboundp 'user-mail-address)
+		 (user-mail-address))
+		((boundp 'user-mail-address)
+		 user-mail-address)
+		(t ""))
+	  ">  "
+	  (current-time-string))))))
     (if (buffer-modified-p errbuf)
 	(progn
 	  (display-buffer errbuf)
 	  (error "Failed to update game score file"))
       (kill-buffer errbuf))
-    (save-excursion
-      (let ((buf (find-buffer-visiting target)))
-	(if buf
-	    (progn
-	      (with-current-buffer buf
-		(revert-buffer nil t nil))
-	      (display-buffer buf))
-	  (find-file-read-only-other-window target))))))
+    (let ((buf (find-buffer-visiting target)))
+      (if buf
+	  (progn
+	    (with-current-buffer buf
+	      (revert-buffer nil t nil))
+	    (display-buffer buf))
+	(find-file-read-only-other-window target)))))
 
 (defun gamegrid-add-score-insecure (file score &optional directory)
   (save-excursion