     (define-key merlin-map (kbd "C-c r") 'merlin-restart-process)
     (define-key merlin-map (kbd "C-c C-x") 'merlin-next-error)
     (define-key merlin-map (kbd "C-c C-l") 'merlin-locate)
+    (when (featurep 'auto-complete)
+      (define-key ac-complete-mode-map (kbd "C-c C-l") 'ac-merlin-locate))
     (define-key merlin-map (kbd "C-c &") 'merlin-pop-stack)
     (define-key merlin-map (kbd "C-c C-r") 'merlin-rewind)
     (define-key merlin-map (kbd "C-c C-u") 'merlin-refresh)

  (interactive)
  (merlin-check-synchronize)
  (merlin-goto-phrase "prev" 0))
    
(defun merlin-to-point ()
  "Update the merlin to the current point, reporting error."
  (interactive)

      (message "No project file for the current buffer."))))
;; Locate
(defvar merlin-position-stack nil)

(defun merlin-locate-pure (ident &optional point just-open)
  "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))))))
    (if (and r (listp r))
        (if just-open
            (save-excursion
              (save-selected-window
                (merlin-goto-file-and-point r just-open)
                (merlin-highlight (bounds-of-thing-at-point 'ocamlatom) 'merlin-type-face)))
          (progn
            (merlin-goto-file-and-point r)
            (push (cons (buffer-name) (point)) merlin-position-stack)
            (message "Use %s to go back."
                     (substitute-command-keys "\\[merlin-pop-stack]"))))
          (message "%s not found." ident))))

(defun merlin-locate ()
  "Locate the identifier under point"
  (interactive)
  (merlin-locate-pure (thing-at-point 'ocamlatom)))

;; I don't like it beginning by "ac" but
;; it is the only way I found to get it working (otherwise the completion
;; menu just closes itself)
(defun ac-merlin-locate ()
  "Locate the identifier currently selected in the ac-completion."
  (interactive)
  (when (ac-menu-live-p)
    (when (popup-hidden-p ac-menu)
      (ac-show-menu))
    (merlin-locate-pure (popup-selected-item ac-menu) (point) t)
    (ac-show-menu)))

(defun merlin-pop-stack ()
  "Go back to the last position"
