     (eq 0 (compare-buffer-substrings
            (get-buffer vimgolf-work-buffer-name) (point-min-in-buffer vimgolf-work-buffer-name) (point-max-in-buffer vimgolf-work-buffer-name)
            (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 ()
-  (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)
-  (if file (open-dribble-file file) (vimgolf-close-and-capture-dribble)))
 
 (defun vimgolf-wrong-solution ()
   (message "Wrong!")

  (with-current-buffer (get-buffer-create vimgolf-work-buffer-name)
    (delete-region (point-min) (point-max))
    (insert-buffer (get-buffer-create vimgolf-start-buffer-name))
    (clear-dribble-file)
    (set-window-configuration vimgolf-working-window-configuration)
    (message "If at first you don't succeed, try, try again.")))

(defun vimgolf-diff ()
  "Pause the competition and view differences between the buffers."
  (interactive)
  (vimgolf-open-dribble-file nil)
  (ediff-buffers (get-buffer-create vimgolf-work-buffer-name) (get-buffer-create vimgolf-end-buffer-name))
  (message "Remember to `C-c C-v c` when you're done."))

(defun vimgolf-continue ()
  "Restore work and end buffers and begin recording keystrokes again."
  (interactive)
  (vimgolf-open-dribble-file vimgolf-dribble-file-path)
  (set-window-configuration vimgolf-working-window-configuration)
  (message "Golf away!"))

(defun vimgolf-pause ()
  "Stop recording keystrokes."
  (interactive)
  (vimgolf-open-dribble-file nil)
  (message "Come `C-c C-v c` soon."))

(defun vimgolf-quit ()

      (display-buffer vimgolf-end-buffer 'display-buffer-pop-up-window)
      (set-window-buffer (selected-window) vimgolf-work-buffer)
      (switch-to-buffer vimgolf-work-buffer)
      (vimgolf-capture-keystrokes)
      (setq vimgolf-working-window-configuration (current-window-configuration)))))

;;; vimgolf.el ends here
