   "Cleans the buffer being killed."
   (if merlin-mode
       (merlin-process-remove-user)))
-  
-(defun merlin-insinuate ()
-  "Initialize merlin globally."
-  (add-hook 'after-save-hook (lambda ()
-                               (if merlin-mode
-                                   (merlin-to-point))))
-  (add-hook 'kill-buffer-hook 'merlin-kill-buffer-hook))
-                                      
+ 
+(add-hook 'merlin-mode-hook
+          (lambda ()
+            (add-hook 'kill-buffer-hook 'merlin-kill-buffer-hook nil 'make-it-local)
+            (add-hook 'after-save-hook 'merlin-to-end nil 'make-it-local)))
+
 (defun merlin-kill-all-processes ()
   "Kill all the remaining buffers containing merlin processes."
   (interactive)

      ((bounds (bounds-of-thing-at-point 'ocaml-atom))
       (start  (if bounds (car bounds) (point)))
       (end    (point))
       (string (if bounds (buffer-substring-no-properties start end) "")))
    (setq merlin-completion-annotation-table
          (mapcar (lambda (a) (cons (car a) (concat ": " (cadr a))))
                  (merlin-completion-data string)))


(defun merlin-goto-point (data)
  "Go to the point indicated by `DATA' which must be an assoc list with fields line and col"
  (goto-char (point-max))
  (let* ((line-max (line-number-at-pos nil))
         (col-max  (current-column))
         (line     (cdr (assoc 'line data)))
         (col      (cdr (assoc 'col data))))
    (when (<= line line-max)
      (goto-char (point-min))
      (forward-line (1- line))
      (move-to-column col))))

(defun merlin-goto-file-and-point (data &optional same-buffer-force)
  "Go to the file and position indicated by DATA which is an assoc list containing fields file, line and col.
