            (get-buffer vimgolf-end-buffer-name) (point-min-in-buffer vimgolf-end-buffer-name) (point-max-in-buffer vimgolf-end-buffer-name)))))
 
 (defun vimgolf-close-and-capture-dribble ()
-  (save-current-buffer
-    (let ((temp-buffer (find-file-noselect vimgolf-dribble-file-path)))
-      (set-buffer temp-buffer)
-      (append-to-file (point-min) (point-max) vimgolf-keystrokes-file-path)
-      (kill-buffer temp-buffer)))
+  (with-current-buffer (find-file-noselect vimgolf-dribble-file-path)
+    (append-to-file (point-min) (point-max) vimgolf-keystrokes-file-path)
+    (kill-buffer))
   (open-dribble-file nil))
 
 (defun vimgolf-open-dribble-file (file)

(defvar vimgolf-end-buffer-name "*vimgolf-end*")

(defun point-min-in-buffer (buffer)
  (save-current-buffer
    (set-buffer buffer)
    (point-min)))

(defun point-max-in-buffer (buffer)
  (save-current-buffer
    (set-buffer buffer)
    (point-max)))

(defun vimgolf-solution-correct-p ()

  (single-key-description (string-to-number (substring keychord-string 2) 16)))

(defun vimgolf-parse-dribble-file (file)
  (with-current-buffer (find-file-noselect file)
    (beginning-of-buffer)
    (while (re-search-forward "0x[1-9]0000[a-z0-9]\\{2\\}" nil t)
      (replace-match (vimgolf-parse-keychord (match-string 0))))
    (save-buffer)
    (kill-buffer)))

(defun vimgolf-right-solution ()
  (message "Hurray!")
