     (if (not end-p)
         (merlin-send-command "tell" '("end" nil)))
     (merlin-check-for-errors view-errors-p)
-    (setq merlin--point (merlin-get-position))
+    (setq merlin-lock-point (merlin-get-position))
     (merlin-update-lock-zone-display)))
 
       

(defun merlin-setup ()
  "Set up a buffer for use with merlin."
  (interactive)
  ; if there is not yet a buffer for the current buffer, create one
  (when (not (merlin-process-started-p))
      (merlin-start-process nil))
  (set (make-local-variable 'merlin-local-process)
       (merlin-get-process-variable 'merlin-local-process))
  (merlin-process-add-user)

  (when (and (fboundp 'auto-complete-mode)
             merlin-use-auto-complete-mode)
    (auto-complete-mode 1)
    (add-to-list 'ac-sources 'merlin-ac-source))
  (add-hook 'completion-at-point-functions
            #'merlin-completion-at-point nil 'local)
  (set (make-local-variable 'merlin-lock-point) (point-min))
  (set (make-local-variable 'merlin-buffer) nil)
  (set (make-local-variable 'merlin-result) nil)

  (set (make-local-variable 'merlin-ready) nil)
  (set (make-local-variable 'merlin-pending-errors) nil)
  (set (make-local-variable 'merlin-pending-errors-overlays) nil)
  (set (make-local-variable 'merlin-lock-zone-highlight-overlay) nil)
  (set (make-local-variable 'merlin-lock-zone-margin-overlay) nil)
  (set (make-local-variable 'merlin--project-file) nil)
  (set (make-local-variable 'merlin-enclosing-types) nil)
  (set (make-local-variable 'merlin-enclosing-offset) nil)
  (set (make-local-variable 'merlin-last-point-type) nil)
  ; if there is not yet a buffer for the current buffer, create one
  (when (not (merlin-process-started-p))
      (merlin-start-process nil))
  (set (make-local-variable 'merlin-local-process)
       (merlin-get-process-variable 'merlin-local-process))
  (merlin-process-add-user)

  (when (and (fboundp 'auto-complete-mode)
             merlin-use-auto-complete-mode)
    (auto-complete-mode 1)
    (add-to-list 'ac-sources 'merlin-ac-source))
  (add-hook 'completion-at-point-functions
            #'merlin-completion-at-point nil 'local)
  (add-to-list 'after-change-functions 'merlin-edit)
  (merlin-load-project-file)
  (with-current-buffer (get-buffer-create merlin-type-buffer-name)
