   "Start a new server using HMAC-SECRET as its hmac secret."
   (let ((proc-buff (get-buffer-create ycmd--server-buffer-name)))
     (with-current-buffer proc-buff
+      (buffer-disable-undo proc-buff)
       (erase-buffer)
 
       (let* ((options-file (ycmd--create-options-file hmac-secret))

                (ycmd--with-all-ycmd-buffers (ycmd--report-status 'unparsed))))
             (t
              ;; timeout after specified period
              (when (< (/ ycmd-startup-timeout 1000) (- (float-time) start-time))
                (ycmd--with-all-ycmd-buffers (ycmd--report-status 'errored))
                (when (ycmd-running?) (ycmd-close))
                (error "ERROR: Ycmd server timeout"))))))))))


  (ycmd--start-keepalive-timer))

(defun ycmd-close ()
  "Shutdown any running ycmd server.

This does nothing if no server is running."
  (interactive)
  (when (ycmd-running?)
    (ycmd--stop-server))
  (ycmd--global-teardown)
  (ycmd--kill-timer ycmd--keepalive-timer))

(defun ycmd--stop-server ()
  "Stop the ycmd server process.

Call `interrupt-process' for the ycmd server and wait for the
ycmd server to stop.  If the ycmd server is still running after a
timeout specified by `ycmd-delete-process-delay', then kill the
process with `delete-process'."
  (condition-case nil
      (let ((start-time (float-time)))
        (interrupt-process ycmd--server-process)
        (while (and (ycmd-running?)
                    (> ycmd-delete-process-delay
                       (- (float-time) start-time)))
          (sit-for 0.05))
        (delete-process ycmd--server-process))
    (error nil)))

(defun ycmd-running? ()
  "Return t if a ycmd server is already running."
  (process-live-p (get-process ycmd--server-process)))

(defun ycmd--keepalive ()
  "Sends an unspecified message to the server.
