Function: gamegrid-add-score-with-update-game-score-1

gamegrid-add-score-with-update-game-score-1 is a byte-compiled function defined in gamegrid.el.gz.

Signature

(gamegrid-add-score-with-update-game-score-1 FILE TARGET SCORE &optional REVERSE)

Source Code

;; Defined in /usr/src/emacs/lisp/play/gamegrid.el.gz
(defun gamegrid-add-score-with-update-game-score-1 (file target score &optional reverse)
  (let ((default-directory "/")
	(errbuf (generate-new-buffer " *update-game-score loss*"))
        (marker-string (concat
			(user-full-name)
			" <" user-mail-address ">  "
			(current-time-string))))
    ;; This can be called from a timer, so enable local quits.
    (with-local-quit
      (apply
       'call-process
       `(,(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))
         ,@(if reverse '("-r"))
         ,file
         ,(int-to-string score)
         ,marker-string)))
    (if (buffer-modified-p errbuf)
	(progn
	  (display-buffer errbuf)
	  (error "Failed to update game score file"))
      (kill-buffer errbuf))
    (let ((buf (find-buffer-visiting target)))
      (save-excursion
        (if buf
	    (progn
	      (switch-to-buffer buf)
	      (revert-buffer nil t nil)
	      (display-buffer buf))
	  (find-file-read-only target))
        (view-mode)
        (goto-char (point-min))
        (search-forward (concat (int-to-string score)
				" " (user-login-name) " "
				marker-string) nil t)
        (beginning-of-line)))))