 (defun ycmd--global-teardown ()
   "Teardown ycmd in all buffers."
   (ycmd--kill-timer ycmd--on-focus-timer)
-  (dolist (buffer (buffer-list))
-    (with-current-buffer buffer
-      (when ycmd-mode
-        (ycmd--teardown)))))
+  (ycmd--with-all-ycmd-buffers (ycmd--teardown)))
 
 (defun ycmd-diagnostic-file-types (mode)
   "Find the ycmd file types for MODE which support semantic completion.

              (progn
                (set-variable 'ycmd--server-actual-port
                              (string-to-number (match-string 1 proc-output)))
                (setq cont nil)))
             (t
              ;; timeout after specified period
              (when (< (/ ycmd-startup-timeout 1000) (- (float-time) start-time))
                (with-current-buffer orig-buff
                  (ycmd--report-status 'errored))
                (error "Server timeout"))))))))))

(defun ycmd--column-in-bytes ()
  "Calculate column offset in bytes for the current position and buffer."

  (ycmd--kill-timer ycmd--keepalive-timer))

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

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