emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/play/gamegrid.el


From: Colin Walters
Subject: [Emacs-diffs] Changes to emacs/lisp/play/gamegrid.el
Date: Wed, 10 Apr 2002 15:13:35 -0400

Index: emacs/lisp/play/gamegrid.el
diff -c emacs/lisp/play/gamegrid.el:1.5 emacs/lisp/play/gamegrid.el:1.6
*** emacs/lisp/play/gamegrid.el:1.5     Sun Mar  3 09:13:53 2002
--- emacs/lisp/play/gamegrid.el Wed Apr 10 15:13:35 2002
***************
*** 406,430 ****
  
  (defun gamegrid-add-score (file score)
    "Add the current score to the high score file."
    (save-excursion
!   (find-file-other-window file)
!   (setq buffer-read-only nil)
!   (goto-char (point-max))
!   (insert (format "%05d\t%s\t%s <%s>\n"
!                 score
!                 (current-time-string)
!                 (user-full-name)
!                 (cond ((fboundp 'user-mail-address)
!                        (user-mail-address))
!                       ((boundp 'user-mail-address)
!                        user-mail-address)
!                       (t ""))))
!   (sort-numeric-fields 1 (point-min) (point-max))
!     (reverse-region (point-min) (point-max))
!   (goto-line (1+ gamegrid-score-file-length))
!   (delete-region (point) (point-max))
!   (setq buffer-read-only t)
!     (save-buffer)))
  
  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  
--- 406,440 ----
  
  (defun gamegrid-add-score (file score)
    "Add the current score to the high score file."
+   (let ((result nil)
+       (errbuf (generate-new-buffer " *update-game-score loss*")))
+     (let ((default-directory "/"))
+       (apply
+        'call-process
+        (append
+       (list
+        (expand-file-name "update-game-score" exec-directory)
+        nil errbuf nil
+        "-m" (int-to-string gamegrid-score-file-length) 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
!     (find-file-read-only-other-window (expand-file-name file 
game-score-directory))))
!       
  
  ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  



reply via email to

[Prev in Thread] Current Thread [Next in Thread]