            do (lean-server-send-cmd-async (lean-cmd-replace n (lean-grab-line n)))
            finally (setq lean-changed-lines nil)))
 
-(defun lean-server-visit-current-buffer ()
-  "Send VISIT for the current buffer"
-  (cond ((and (buffer-modified-p)
-              (not lean-global-server-current-file-name))
-         (lean-server-handle-modified-buffer))
-        (t (lean-server-send-cmd-async (lean-cmd-visit)))))
-
 (defun lean-server-check-current-file (&optional file-name)
   "Check lean-global-server-current-file-name
 

  (let ((current-file-name (or file-name (buffer-file-name))))
    (unless (string= lean-global-server-current-file-name
                     current-file-name)
      (lean-server-visit-current-buffer))))

(defun lean-server-before-send-cmd (cmd)
  "Operations to perform before sending a command."

(defun lean-server-after-send-cmd (cmd)
  "Operations to perform after sending a command."
  (cl-case (lean-cmd-type cmd)
    ('LOAD    (lean-server-delete-cache-file)
              (lean-server-handle-modified-buffer))
    ('VISIT   (lean-server-delete-cache-file)
              (lean-server-handle-modified-buffer))
    ('REPLACE ())
    ('INSERT  ())
    ('REMOVE  ())
