      'bounds-of-ocaml-atom-at-point)
 
 ; overlay management
+(defun merlin-put-margin-overlay (overlay s &optional face)
+  "Put a margin overlay inside `overlay', with face `face' and string `string'"
+  (set-window-margins nil 1)
+  (if face
+      (overlay-put overlay 'face face))
+  (overlay-put overlay
+               'before-string 
+               (propertize " " 'display 
+                           `((margin left-margin) ,s)
+                           )))
+
 (defun merlin-create-overlay (var bounds face timer)
   "Creates an overlay in the current buffer starting at `start', ending at `end',
 using `face' and storing it in `var'. If `timer' is non-nil, the overlay is to disappear after `timer' seconds

    (goto-char merlin-lock-point)
    (setq merlin-lock-zone-margin-overlay (make-overlay (point) (point)))
    (set-window-margins nil 1)
    (overlay-put merlin-lock-zone-margin-overlay 
                 'before-string 
                 (propertize " " 'display `((margin left-margin) ,merlin-margin-lock)))))

(defun merlin-update-highlight-lock-zone ()
  (if merlin-lock-zone-highlight-overlay

                   (let ((overlay (make-overlay
                                   (merlin-make-point (cdr (assoc 'start err)))
                                   (merlin-make-point (cdr (assoc 'end err))))))
                     (if (string-match (cdr (assoc 'message err)) "^Warning")
                         (merlin-put-margin-overlay overlay "!" compilation-error-face)
                       (merlin-put-margin-overlay overlay "?" compilation-warning-face))
                     overlay)) errors))
  (message "(pending error, use C-c C-x to jump)"))

