     keymap)
   "The local map to navigate type enclosing.")
 
-(defun merlin-type-enclosing ()
-  "Print the type of the expression under point (or of the region, if it exists)."
-  (interactive)
-  (merlin-sync-to-point)
-  (save-excursion
-    (if (region-active-p)
-        (merlin--type-region)
-      (when (merlin--type-enclosing-query)
-        (merlin-type-enclosing-go-up))))
+(defun merlin--type-enclosing-after ()
   (when (and (fboundp 'set-temporary-overlay-map)
              merlin-arrow-keys-type-enclosing)
     (set-temporary-overlay-map merlin-type-enclosing-map t)))
+
+(defun merlin-type-enclosing ()
+  "Print the type of the expression under point (or of the region, if it exists)."
+  (interactive)
+  (merlin-sync-to-point)
+  (if (region-active-p)
+      (merlin--type-region #'merlin--type-enclosing-after)
+    (merlin--type-enclosing-query
+     (lambda (success)
+       (when success (merlin-type-enclosing-go-up))
+       (merlin--type-enclosing-after)))))
 
 (defun merlin--find-extents (list low high)
   "Return the smallest extent in LIST that LOW and HIGH fit

      (if (and (not quiet) bounds)
          (merlin-highlight bounds 'merlin-type-face)))))

(defun merlin--type-region ()
  "Show the type of the region."
  (lexical-let*
      ((substring (merlin--buffer-substring (region-beginning) (region-end)))
       (on-success (lambda (type) (merlin--type-display nil type nil)))
       (on-error   (lambda (err)
                     (let ((msg (assoc 'message err))
                           (typ (assoc 'type err)))

    (define-key merlin-map (kbd "C-c C-r") 'merlin-error-check)
    (define-key merlin-map (kbd "C-c TAB") 'merlin-try-completion)
    (define-key merlin-map (kbd "C-c C-t") 'merlin-type-enclosing)
    (define-key merlin-map (kbd "C-c C-n") 'merlin-phrase-next)
    (define-key merlin-map (kbd "C-c C-p") 'merlin-phrase-prev)
    (define-key merlin-menu-map [customize]
