From 389fe02597e35b0363c5e7a0657b144f20cf05bb Mon Sep 17 00:00:00 2001 From: Soonho Kong Date: Thu, 11 Sep 2014 12:35:26 -0700 Subject: [PATCH] fix(emacs/lean-server): handle modified buffer only when process start --- src/emacs/lean-server.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/emacs/lean-server.el b/src/emacs/lean-server.el index ac7216536..ad8e1681e 100644 --- a/src/emacs/lean-server.el +++ b/src/emacs/lean-server.el @@ -240,8 +240,11 @@ Send REPLACE commands to lean-server, reset lean-changed-lines to nil." finally (setq lean-changed-lines nil))) (defun lean-server-visit-current-buffer () - (cond ((buffer-modified-p) (lean-server-handle-modified-buffer)) - (t (lean-server-send-cmd-async (lean-cmd-visit))))) + (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 @@ -554,7 +557,7 @@ Otherwise, set an idle-timer to call the handler again" (let ((temp-file (make-temp-file prefix))) (with-current-buffer (flymake-copy-buffer-to-temp-buffer (current-buffer)) (set-visited-file-name temp-file) - (save-buffer) + (save-buffer 0) (kill-buffer)) temp-file))