                  (not (caml-types-date< caml-types-annotation-date type-date)))
       (if (caml-types-date< type-date target-date)
           (error (format "%s is more recent than %s" target-file type-file)))
-      (message "reading annotation file...")
-      (let ((tree (with-current-buffer type-buf
+      (message "Reading annotation file...")
+      (let* ((type-buf (caml-types-find-file type-file))
+             (tree (with-current-buffer type-buf
                     (widen)
                     (goto-char (point-min))
                     (caml-types-build-tree target-file))))
         (setq caml-types-annotation-tree tree
               caml-types-annotation-date type-date)
-        (message "")))))
+        (kill-buffer type-buf)
+        (message ""))
+      )))
 
 (defun caml-types-date< (date1 date2)
   (or (< (car date1) (car date2))

            (forward-char 1))
          (setq type-info
                (if (looking-at
                            "^type(\n\\(  \\([^\n)]\\|.)\\|\n[^)]\\)*\n\\))")
                    (cons (match-beginning 1) (match-end 1))))
          (setq accu ())
          (while (and stack
                      (caml-types-pos-contains l-cnum r-cnum (car stack)))

(overlay-put caml-types-expr-ovl 'face 'caml-types-face)


(defvar caml-types-annotation-tree nil)
(defvar caml-types-annotation-date nil)
(make-variable-buffer-local 'caml-types-annotation-tree)
(make-variable-buffer-local 'caml-types-annotation-date)

(defvar caml-types-buffer-name "*caml-types*"
  "Name of buffer for diplaying caml types")
(defvar caml-types-buffer nil
  "buffer for diplaying caml types")

(defun caml-types-show-type (arg)
  "Show the type of expression or pattern at point.
