   '((after-save-hook                  . ycmd--on-save)
     (after-change-functions           . ycmd--on-change)
     (window-configuration-change-hook . ycmd--on-window-configuration-change)
-    (kill-buffer-hook                 . ycmd--teardown)
+    (kill-buffer-hook                 . ycmd--close-buffer)
     (before-revert-hook               . ycmd--teardown))
   "Hooks which ycmd hooks in.")
 

      s
    (encode-coding-string s 'utf-8 t)))

(defun ycmd--standard-content (buffer pos)
  "Generate the 'standard' content for ycmd posts.


      (ycmd--handle-exception results)
    (ycmd--report-status 'parsed)
    (run-hook-with-args 'ycmd-file-parse-result-hook results)))

(defun ycmd--notify-server (event-name &optional event-content-alist)
  "Send a simple event notification for EVENT-NAME to the
server, ignoring response. Optionally, include EVENT-CONTENT-ALIST
as additional content in the request."
  (let* ((buff (current-buffer))
         (pos (point))
         (content (append (cons `("event_name" . ,event-name)
                                (ycmd--standard-content buff pos))
                          event-content-alist)))
    (deferred:$
      ;; try
      (ycmd--request "/event_notification"
                     content
                     :parser 'json-read)
      (deferred:error it
        (lambda (err)
          (message "Error sending %s request: %s" event-name err)
          (ycmd--report-status 'errored))))))

(defun ycmd-notify-file-ready-to-parse ()
  "Send a notification to ycmd that the buffer is ready to be parsed.
