             (r-line (string-to-int (match-string 8)))
             (r-bol (string-to-int (match-string 9)))
             (r-cnum (string-to-int (match-string 10))))
-        (while (and (re-search-forward "^" () t)
-                    (not (looking-at "type"))
-                    (not (looking-at "\\\"")))
-          (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)))
-          (setq accu (cons (car stack) accu))
-          (setq stack (cdr stack)))
-        (let* ((left-pos (vector l-file l-line l-bol l-cnum))
-               (right-pos (vector r-file r-line r-bol r-cnum))
-               (node (caml-types-make-node left-pos right-pos type-info accu)))
-          (setq stack (cons node stack)))))
+        (unless (not (and (string= l-file target-file)
+                          (string= r-file target-file)))
+          (while (and (re-search-forward "^" () t)
+                      (not (looking-at "type"))
+                      (not (looking-at "\\\"")))
+            (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)))
+            (setq accu (cons (car stack) accu))
+            (setq stack (cdr stack)))
+          (let* ((left-pos (vector l-file l-line l-bol l-cnum))
+                 (right-pos (vector r-file r-line r-bol r-cnum))
+                 (node (caml-types-make-node left-pos right-pos type-info
+                                             accu)))
+            (setq stack (cons node stack))))))
     (if (null stack)
-        (vector)
+        (let ((dummy-pos (vector "" 0 0 0)))
+          (vector dummy-pos dummy-pos ()))
       (let* ((left-pos (elt (car (last stack)) 0))
              (right-pos (elt (car stack) 1)))
         (if (null (cdr stack))

     (t
      (setq left nleft
            right nright)
      (while (and (< i (length node))
                  (caml-types-pos<= (elt (elt node i) 0) targ-pos))
        (setq i (1+ i)))
      (if (< i (length node))
          (setq right (elt (elt node i) 0)))
      (if (> i 3)

       (>= r-cnum (elt (elt node 1) 3))))

(defun caml-types-find-location (targ-pos curr node)
  (if (not (caml-types-pos-inside targ-pos node))
      curr
    (if (elt node 2)
        (setq curr node))
    (let ((i (caml-types-search node targ-pos)))
      (if (and (> i 3)
               (caml-types-pos-inside targ-pos (elt node (1- i))))
          (caml-types-find-location targ-pos curr (elt node (1- i)))
        curr))))

; trouve le premier fils qui commence apres la position
; ou (length node) si tous commencent avant
;(defun caml-types-search (node pos)
;  (let ((min 3)
;        (max (length node))
;        med)
;    (while (< min max)
;      (setq med (/ (+ min max) 2))
;      (if (caml-types-pos<= (elt (elt node med) 0) pos)
;          (setq min (1+ med))
;        (setq max med)))
;    min))

; a remplacer par une dichotomie
(defun caml-types-search (node pos)
  (let ((i 3))
    (while (and (< i (length node))
                (caml-types-pos<= (elt (elt node i) 0) targ-pos))
      (setq i (1+ i)))
    i))

(defun caml-types-pos-inside (pos node)
  (let ((left-pos (elt node 0))
