 
 ;; Look for identifiers around point
 
-(defun ocaml-current-position ()
-  "Return a pair (MODULE . ENTRY) such that point is above ENTRY and 
-MODULE is the module preceeding ENTRY.
-
-Both are a pair of position (BEG . END) in the buffer and can be nil if
-undefined."
+(defun ocaml-qualified-identifier (&optional show)
+  "Search for a qualified identifier (Path. entry) around point. 
+
+Entry may be nil.
+Currently, the path may only be nil or a single Module. 
+For paths is of the form Module.Path', it returns Module 
+and always nil for entry. 
+
+If defined Module and Entry are represented by a region in the buffer, 
+and are nil otherwise. 
+
+For debugging purposes, it returns the string Module.entry if called 
+with an optional non-nil argument. 
+"
   (save-excursion
     (let ((module) (entry))
       (if (re-search-backward
-           "\\(\\<[A-Z][A-Za-z0-9_]*\\>\\.\\|[^.]\\)\\<[A-Za-z0-9_]*\\="
+           "[^A-Za-z0-9_.']\\([A-Za-z0-9_']*[.]\\)*[A-Za-z0-9_']*\\="
            (- (point) 100) t)
           (progn
-            (if (looking-at "\\<\\([A-Za-z_'][A-Za-z0-9_']*\\)\\>[.]")
+            (forward-char 1)
+            (if (looking-at "\\<\\([A-Za-z_][A-Za-z0-9_']*\\)[.]")
                 (progn
                   (setq module (cons (match-beginning 1) (match-end 1)))
                   (goto-char (match-end 0))))
-            (if (looking-at "\\<\\([a-z_'][A-Za-z0-9_']*\\)\\>")
-                (progn (message "TROIS")
-                (setq entry (cons (match-beginning 1) (match-end 1)))))))
+            (if (looking-at "\\<\\([a-z_][A-Za-z0-9_']*\\)\\>")
+                (setq entry (cons (match-beginning 1) (match-end 1))))))
+      (if show
+          (concat
+           (and module (buffer-substring (car module) (cdr module)))
+           "."
+           (and entry (buffer-substring (car entry) (cdr entry))))
       (cons module entry))
-    ))
+    )))
 
 ;; completion around point
 


;; variables to be customized

(defvar ocaml-lib-path
  '("/usr/lib/ocaml/" "/usr/local/lib/ocaml/")
  "Path for ocaml lib sources (mli files)")

(defvar ocaml-info-alist 'ocaml-info-default-function
  "A-list binding module names to info entries: 

  )

(defun caml-help (arg)
  "Find help for qualified identifiers. 

It attemps to recognize an qualified identifier of the form Module . entry 
around point using function \\[ocaml-qualified-identifier].

If Module is undefined it finds it from indentifier and visible modules, 
or asks the user interactively. 

It then opens the info documentation for Module if available or 
to the Module.mli file otherwises, and searches for entry. 

With prefix arg 0, it recomputes visible modules and their content. 
With prefix arg 4, it prompt for Module instead of its contectual value. 
"
  (interactive "p")
  (let ((module) (entry))
    (cond
     ((= arg 4)
      (or (and
           (setq module
                (completing-read "Module: " ocaml-module-alist nil t))
