 
 (defun merlin-reset-user ()
   "Checks whether we need to change the current buffer viewed by merlin."
-  (let ((name buffer-file-name))
-    (with-current-buffer (merlin-process-buffer)
-      (when (not (string-equal merlin-process-last-user name))
-        (setq merlin-process-last-user name)
-        (merlin-load-project-file name)))))
+  (unless (merlin-is-last-user-p)
+    (let ((name (buffer-name)))
+      (with-current-buffer (merlin-process-buffer)
+        (setq merlin-process-last-user name)))
+    (merlin-load-project-file)))
 
 (defun merlin-send-command-async (command callback-if-success &optional callback-if-exn)
   "Send COMMAND (with arguments ARGS) to merlin asynchronously.

      ((bounds (bounds-of-thing-at-point 'ocaml-atom))
       (start  (if bounds (car bounds) (point)))
       (end    (if bounds (cdr bounds) (point)))
       (string (if bounds (merlin-buffer-substring start end) ""))
       (request (if string (replace-regexp-in-string "[^\\.]+$" "" string))))
    (merlin--kill-overlapping-errors start end)
    (when (or (not merlin-completion-at-point-cache-query)

    (when failed (message (cdr failed))))
  (merlin-error-reset))

(defun merlin-load-project-file ()
  "Load the .merlin file corresponding to the current buffer."
  (interactive)
  (when buffer-file-name
    (let* ((r (merlin-send-command `(project find ,buffer-file-name)))
           (failed (assoc 'failures r))
           (result (assoc 'result r)))
      (when failed (message (cdr failed)))
      (when (and result (listp (cdr result)))
        (setq merlin-project-file (cadr result)))
      (merlin-rewind))))

(defun merlin-goto-project-file ()
  "Goto the merlin file corresponding to the current file."
