   :lighter " ycmd"
   :group 'ycmd
   :require 'ycmd
-  :after-hook (ycmd--set-buffer-needs-parse 'mode-enabled)
+  :after-hook (ycmd--conditional-parse 'mode-enabled)
   (cond
    (ycmd-mode
     (dolist (hook ycmd-hooks-alist)

           (ycmd--log-content "HTTP RESPONSE CONTENT" content)
           content))))))

(defun ycmd--set-buffer-needs-parse (&optional condition)
  "Mark buffer for parsing at CONDITION.

The buffer will be marked for parsing, if CONDITION is in
`ycmd-parse-conditions' or nil."
  (when (and ycmd-mode
             (or (not condition)
                 (memq condition ycmd-parse-conditions)))


(defun ycmd--on-save ()
  "Function to run when the buffer has been saved."
  (ycmd--conditional-parse 'save))

(defun ycmd--on-idle-change ()
  "Function to run on idle-change."
  (ycmd--kill-notification-timer)
  (ycmd--conditional-parse 'idle-change))

(defun ycmd--on-change (beg end _len)
  "Function to run when a buffer change between BEG and END."
