     (add-to-list 'ac-sources 'merlin-ac-source))
   (add-hook 'completion-at-point-functions
             #'merlin-completion-at-point nil 'local)
+  (setq (make-local-variable 'completion-extra-properties) '(:exit-function (lambda (s status) (message "haha: %s" status))))
   (set (make-local-variable 'merlin-lock-point) (point-min))
   (set (make-local-variable 'merlin-buffer) nil)
   (set (make-local-variable 'merlin-result) nil)

  (ac-define-source "merlin" merlin-ac-source))

;; Usual completion
(defun merlin-completion-at-point ()
  (save-excursion
    (merlin-check-synchronize))

            (run-with-idle-timer merlin-idle-delay t 'merlin-idle-hook)))
  (with-current-buffer merlin-type-buffer
    (funcall merlin-favourite-caml-mode)))

;;;###autoload
(define-minor-mode merlin-mode
  "Minor mode for interacting with a merlin process.
Runs a merlin process in the background (one for all merlin
