 (defvar merlin-pending-errors nil
   "Pending errors.")
 (make-variable-buffer-local 'merlin-pending-errors)
-
-(defvar merlin-pending-errors-overlays nil
-  "Overlays for the pending errors.")
-(make-variable-buffer-local 'merlin-pending-errors-overlays)
 
 (defvar merlin-highlight-overlay nil
   "Merlin overlay used for highlights.")

				     end
				     &optional length)
  "Remove an error from the pending error lists if it is edited by the user."
  (when is-after
    (let ((err (nth (position overlay merlin-pending-errors-overlays)
		    merlin-pending-errors)))
      (setq merlin-pending-errors
	    (delete err merlin-pending-errors))
      (setq merlin-pending-errors-overlays
	    (delete overlay merlin-pending-errors-overlays))
      (delete-overlay overlay))))

(defun merlin-error-display-in-margin (errors)
  "Given a list of ERRORS, put annotations in the margin corresponding to them."

  (interactive)
  (setq merlin-pending-errors nil)
  (merlin-error-delete-overlays))

(defun merlin--overlay-p (overlay)
  "Returns non-nil if OVERLAY is managed by merlin."
  (overlay-get overlay 'merlin-kind))

(defun merlin--clear-error-overlay (overlay)
  "Delete an overlay, remove corresponding error from list."
  (let ((err (overlay-get overlay 'merlin-pending-error)))
    (when err (setq merlin-pending-errors
                    (delete err merlin-pending-errors))))
  (delete-overlay overlay))

(defun merlin--kill-error-if-edited (overlay
				     is-after
