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

    (setq ycmd--on-focus-timer
          (run-at-time 1.0 nil #'ycmd--on-unparsed-buffer-focus))))

(defun ycmd--teardown ()
  "Teardown ycmd in current buffer."
  (ycmd--kill-timer ycmd--notification-timer)

              (progn
                (set-variable 'ycmd--server-actual-port
                              (string-to-number (match-string 1 proc-output)))
                (setq cont nil)
                (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"))))))))))

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