       (insert lean-global-server-current-file-name))
     lean-server-process))
 
+(defun lean-server-kill-process ()
+  "Kill lean-server process."
+  (interactive)
+  (let ((proc (get-process lean-server-process-name)))
+    (when proc
+      (with-current-buffer (process-buffer proc)
+        (goto-char (point-max))
+        (insert "Server Killed.\n")
+        (setq lean-global-server-current-file-name nil))
+      (kill-process proc))))
+
+(defun lean-server-restart-process ()
+  "Restart lean-server process."
+  (interactive)
+  (lean-server-kill-process)
+  (lean-server-create-process))
+
 (defun lean-server-get-process ()
-  "Get the lean-server process.
-
-If needed, create a one."
+  "Get lean-server process. If needed, create a one."
   (let ((proc (get-process lean-server-process-name)))
     (cond ((not proc) (lean-server-create-process))
           ((not (process-live-p proc)) (error "TODO(soonhok): need to kill and recreate one"))
           (t proc))))
 
 (defun lean-server-get-buffer ()
-  "Get the lean-server buffer"
+  "Get lean-server buffer."
   (process-buffer (lean-server-get-process)))
 
 ;; How to send data to an async process

    (process-send-string proc string-to-send))
  (lean-server-after-send-cmd cmd))

;; TODO(soonhok): How to kill an async process

(provide 'lean-server)

    ('CHECK   (lean-server-check-current-file))))

(defun lean-server-after-send-cmd (cmd)
  "Operations to perform after sending a command."
  (cl-case (lean-cmd-type cmd)
    ('LOAD    (setq lean-global-server-current-file-name
                    (lean-cmd-load-get-file-name cmd)))
