Function: dun-do-logfile
dun-do-logfile is a byte-compiled function defined in dunnet.el.gz.
Signature
(dun-do-logfile TYPE HOW)
Source Code
;; Defined in /usr/src/emacs/lisp/play/dunnet.el.gz
;; See gamegrid-add-score; but that only handles a single integer score.
(defun dun-do-logfile (type how)
(let (ferror)
(with-temp-buffer
(condition-case err
(if (file-exists-p dun-log-file)
(insert-file-contents dun-log-file)
(let ((dir (file-name-directory dun-log-file)))
(if dir (make-directory dir t))))
(error
(setq ferror t)
(dun-mprincl (error-message-string err))))
(when (null ferror)
(goto-char (point-max))
(dun-minsert (current-time-string) " " (user-login-name) " ")
(if (eq type 'save)
(dun-minsert "saved ")
(if (= (dun-endgame-score) 110)
(dun-minsert "won ")
(if (not how)
(dun-minsert "quit ")
(dun-minsert "killed by " how " "))))
(dun-minsert "at " (cadr (nth (abs dun-room) dun-rooms)) ". score: ")
(if (> (dun-endgame-score) 0)
(dun-minsert (+ 90 (dun-endgame-score)))
(dun-minsert (dun-reg-score)))
(dun-minsertl " saves: " dun-numsaves " commands: " dun-numcmds)
(write-region 1 (point-max) dun-log-file nil 1)))))