   (emc-remove-overlay-at-point))
 
 (defun emc-goto-next-match (pattern &optional direction)
-  "Go to the next match of PATTERN optionally in DIRECTION or 'forward."
+  "Go to the next match of PATTERN optionally in DIRECTION or 'forward. The search does not wrap."
   (let ((pat (evil-ex-make-search-pattern pattern))
         (dir (or direction 'forward)))
     (setq evil-ex-search-pattern pat)

      (delete-overlay cursor)
      (error "No more matches found"))))

(evil-define-command emc-make-next-cursor ()
  "Make the next cursor."
  :repeat ignore
  (interactive)
  (let ((emc-cursor-command t)) ;; TODO: this is no longer needed, but need to ensure that no commands are recorded during cursors creatio
    (setq emc-command-info nil)
    (cond ((evil-visual-state-p)
           (emc-set-pattern-from-visual-selection)
           (emc-maybe-goto-next-match))
          ((emc-get-pattern) (emc-maybe-goto-next-match))
          (t (error "No more matches or no visual selection found")))))

(evil-define-command emc-remove-all-cursors ()

  "Go to next pattern given by `emc-get-pattern'."
  (interactive)
  (when (emc-get-pattern)
    (emc-goto-next-match (emc-get-pattern))))

(defun emc-goto-prev ()
  "Go to prev pattern given by `emc-get-pattern'."
  (interactive)
  (when (emc-get-pattern)
    (emc-goto-next-match (emc-get-pattern) 'backward)
    (emc-goto-next-match (emc-get-pattern) 'backward)
    (emc-goto-next-match (emc-get-pattern) 'forward)))

(defun emc-make-cursor-and-goto-next-match ()
  "Create a cursor at point and go to next match if any."
  (let ((cursor (emc-make-cursor-at-point)))
    (evil-exit-visual-state)
