From: Colin Walters Date: Wed, 10 Apr 2002 19:13:35 +0000 (+0000) Subject: (gamegrid-add-score): Rewrite from scratch to use `update-game-score'. X-Git-Tag: ttn-vms-21-2-B4~15706 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=baf9c39a8c126e8dad9a528bf5f1f0c1f08c6531;p=emacs.git (gamegrid-add-score): Rewrite from scratch to use `update-game-score'. --- diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el index 2ff50ad53eb..ffb179d52d2 100644 --- a/lisp/play/gamegrid.el +++ b/lisp/play/gamegrid.el @@ -406,25 +406,35 @@ static char *noname[] = { (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-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))) + (find-file-read-only-other-window (expand-file-name file game-score-directory)))) + ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;