   (interactive
   (list
    (read-file-name "Filename: ")))
+  
   (ycmd-close)
+  
   (let ((hmac-secret (ycmd-generate-hmac-secret)))
     (ycmd-start-server hmac-secret)
     (setq ycmd-hmac-secret hmac-secret)
     (ycmd-load-conf-file filename))
 
-  ;; TODO: Timer frequency should be configurable
-  (unless ycmd-notification-timer
-    (setq ycmd-notification-timer
-          (ycmd-create-notification-timer)))
+  (ycmd-start-notification-timer)
   
   (add-hook 'kill-emacs-hook (lambda () (ycmd-close))))
 

(defvar ycmd-notification-timer nil
  "Timer for notifying ycmd server to do work, e.g. parsing files.")

(defun ycmd-create-notification-timer ()
  (run-with-idle-timer
   2 t (lambda () (progn
                    (message "timer executed!")
                    (ycmd-notify-file-ready-to-parse (point))))))

(defun ycmd-generate-hmac-secret ()
  "Generate a new, random 16-byte HMAC secret key."


This does nothing if no server is running."
  (interactive)
  
  (unwind-protect
      (when (ycmd-running?)
	(delete-process ycmd-server-process)))
  
  (ycmd-kill-notification-timer))

(defun ycmd-load-conf-file (filename)
  "Tell the ycmd server to load the configuration file FILENAME."
