 ;; - temporarily freeze all fake cursors
 ;; - fake cursors should reflect the current evil state
 ;; - the real cursor should be visible in relation to the fake ones
-
-;; Implementation:
-;; - use `emc-cursor-state' to create cursors and add to `emc-cursor-list'
-;; - cursor navigation using `emc-pattern'
-;;    - the pattern should contain the text as well as type
-;;      region, word, WORD if necessary
-;;
-;; - goto-next
-;; - goto-prev
-;; - goto-first
-;; - goto-last
-;; - make-next
-;; - make-prev
-;; - undo-next
-;; - undo-prev
-;; - skip-next
-;; - skip-prev
-;; - make-here
-;; - undo-here
-;; - make-all
-;; - undo-all
 
 (require 'emc-common)
 (require 'emc-vars)

  :repeat ignore
  (interactive)
  (mapc 'emc-delete-cursor emc-cursor-list)
  (setq emc-cursor-list nil)
  (setq emc-pattern nil))


             (1+ (length emc-cursor-list))
             (emc-get-pattern-text))))

;; All interactive cursor commands should
;; - (emc-command-reset)
;; - set pattern if necessary
;; - if visual-state and (emc-has-cursors-p)
;;   - if point < mark (evil-exchange-point-and-mark for all)
;;   - delete all regions
;; - exit visual mode

;; (defmacro emc-define-cursor-command (command documentation &rest body)
;;   "Define a cursor COMMAND documented by DOCUMENTATION that executes BODY."
;;   `(evil-define-command ,command ()
;;      'documentation
;;      :repeat ignore
;;      (interactive)
;;      ,@body))

;; TODO make this a macro
(defun emc-initialize-cursors
    "Sets up cursors state before an interactive command."
  (emc-command-reset)
  (unless (emc-has-pattern-p) (emc-set-pattern))
  (when (and (evil-visual-state-p) (emc-has-cursors-p))
    (when (< (point) (mark)) (evil-exchange-point-and-mark))
    (dolist (cursor emc-cursor-list)
      (emc-delete-region-overlay cursor)
      ;; TODO remove the region from cursor
      ;; (emc-put-object-property cursor :region nil)
      ))
  (evil-exit-visual-state))

(evil-define-command emc-make-and-goto-first-cursor ()
  "Make a cursor at point and move point to the cursor with the lowest position."
  :repeat ignore
