 	  (append l nil)))
 
 (defun merlin-complete-identifier (ident)
-  "Returns the formatted result of the completion of `ident'"
+  "Return the formatted result of the completion of IDENT."
   (setq merlin-cache nil)
   (setq merlin-cache
 	(merlin-extract-complete (merlin-compute-prefix ident) 
 			   (elt (merlin-get-completion ident) 1)))
   )
 
+;; Vars from auto-complete
+(defvar ac-point)
+(defvar ac-prefix)
+(defvar ac-sources)
+
 (defun merlin-source-init ()
   "Called at the beginning of a completion to fill the cache (the
-variable `merlin-cache')"
+variable `merlin-cache')."
   (setq merlin-idle-point (point))
   (setq merlin-completion-point ac-point)
   (merlin-complete-identifier ac-prefix))
 
 (defun merlin-try-completion ()
-  "Try the merlin completion after having synchronized the point"
+  "Try the merlin completion after having synchronized the point."
   (interactive)
   (merlin-check-synchronize)
   (ac-complete-merlin))

    (merlin-display-type bounds type quiet)))

(defun merlin-get-type-codomain (type)
  "Given a functional type, tries to return its codomain"
  (car (last (split-string type " " nil))))

(defun merlin-show-type-def ()
  "Prints the definition of the type of the term under point"
  (interactive)
  (setq merlin-idle-point (point))
  (let* ((bounds (bounds-of-thing-at-point 'ocamlatom))

;; PROCESS MANAGEMENT

(defun merlin-get-buffer-instance-name ()
  "Return the instance name of the current-projet.
For now it is a constant function (every buffer shares the same instance)."
  "")
(defun merlin-get-process ()
  "Return the process of the current buffer."
  merlin-local-process)

(defun merlin-get-process-buffer-name ()
  "Return the buffer name of the merlin process associated to the current buffer."
  (format "* merlin %s *" (merlin-get-buffer-instance-name)))

(defun merlin-get-process-variable (var)
  "Return the value of a variable (symbol) inside the process buffer."
  (buffer-local-value var (get-buffer (merlin-get-process-buffer-name))))


(defun merlin-get-process-name ()
  "Return the process name for the current buffer."
  (concat "merlin-" (merlin-get-buffer-instance-name))
  )


(defun merlin-filter (process output)
  "The filter on merlin's output."
  (setq merlin-buffer (concat merlin-buffer output))
  (let ((a (ignore-errors (json-read-from-string merlin-buffer))))
  (if a
