                        (buffer-substring-no-properties (car bounds)
                                                        (cdr bounds))))
          (result (merlin-type-of-expression bounds substring)))
-    (cond
-     ((not (cdr result))
-      (if (not quiet)
-          (message "<no information>"))) ;; no types
-     ((and (not (merlin-is-long (cdr result)))
-           (not quiet))
-      (merlin-create-overlay 'merlin-type-overlay
-                             (car result)
-                             'next-error "1 sec")
-      (message "%s" (cdr result)))
-     ((not (merlin-is-long (cdr result)))
-      (message "%s"
-               (cdr result)))
-     ((not quiet)
-      (display-buffer merlin-type-buffer)
-      (with-current-buffer merlin-type-buffer
-        (erase-buffer)
-        (insert (cdr result)))))))
+    (merlin-display-type (car result) (cdr result) &optional quiet)))
 
 (defun merlin-show-type-def ()
   "Prints the definition of the type of the term under point"

   (merlin-type-of-expression-local bounds exp)
   (merlin-type-of-expression-global bounds exp)))

(defun merlin-show-type (bounds &optional quiet)
  "This functions shows the type of the expression inside
`bounds' in the current buffer. If `quiet' is non nil then an

  (let* ((bounds (bounds-of-thing-at-point 'ocamlatom))
         (result (merlin-type-of-expression bounds (buffer-substring-no-properties (car bounds) (cdr bounds))))
         (typedef (cdr (merlin-type-of-expression-global nil (cdr result)))))
    (merlin-display-type bounds
                         (if typedef typedef (concat (cdr result) ": <not an atomic type>")))))


(defun merlin-show-type-of-region ()
