   "Locate the identifier IDENT at POINT.
 If POINT is nil, the current point is used.  If JUST-OPEN is
 non-nil, don't move to the opened buffer."
-  (merlin-check-synchronize)
   (let* ((point (if point point (point)))
-         (r (merlin-send-command "locate" (list ident "at" (merlin-unmake-point (point))))))
+         (r (with-merlin-sync
+             (merlin-send-command "locate" (list ident "at" (merlin-unmake-point (point)))))))
     (if (and r (listp r))
         (if just-open
             (save-excursion

(defun merlin-show-type-of-region ()
  "Show the type of the region."
  (interactive)
  (merlin-check-synchronize)
  (merlin-show-type (cons (region-beginning) (region-end))))
(defun merlin-show-type-of-point-quiet ()
  "Show the type of the identifier under the point if it is short (a value)."
  (merlin-check-synchronize)
  (merlin-show-type (bounds-of-thing-at-point 'ocamlatom) t))

(defun merlin-show-type-of-point (arg) 
  "Show the type of the identifier under the point. 
If it is called with a prefix argument, then show the type of the region."
  (interactive "p")
  (ignore-errors (merlin-check-synchronize))
  (if (> arg 1)
      (merlin-show-type-of-region)
    (merlin-show-type (bounds-of-thing-at-point 'ocamlatom))))

                    (exit-function . merlin-completion-lookup))))
    (unless (and merlin-completion-annotation-table
                 (eq (car merlin-completion-cache-state) start)
                 (string-equal (merlin-compute-prefix string)
                               (merlin-compute-prefix (cdr merlin-completion-cache-state))))
      (save-excursion
        (goto-char start)
        (setq merlin-lock-point (merlin-retract-to (point))))
      (save-excursion
        (with-merlin-sync
         (setq merlin-completion-annotation-table
               (mapcar #'(lambda (a)
                           (cons (car a) (concat ": " (cadr a))))
                       (merlin-completion-data string)))
         (goto-char start)))
      (setq merlin-completion-cache-state (cons start string)))
    (complete-with-action action merlin-completion-annotation-table string pred)))


