       (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.

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

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


  (with-current-buffer buffer
    (let* ((column-num (+ 1 (ycmd--column-in-bytes)))
           (line-num (line-number-at-pos pos))
           (full-path (ycmd--get-full-path-to-current-buffer))
           (file-contents (ycmd--encode-string
                           (buffer-substring-no-properties
                            (point-min) (point-max))))
