 
           ((eq repeat-type 'motion)
            (let ((orig (point)))
-             (funcall cmd)
+             (ignore-errors
+               (condition-case error
+                   (funcall cmd)
+                 (error (message "%s failed with %s" cmd
+                                 (error-message-string error)))))
              (setq region (emc-refresh-region region orig))))
 
-          ;; TODO implement
-          ;; ((eq cmd 'evil-visual-line)
-          ;;  (setq reqion (if region nil
-          ;;                 (emc-refresh-region nil (point) :line))))
+          ((eq cmd 'evil-visual-line)
+           (setq region (if (and region (eq region-type 'line))
+                            (emc-refresh-region nil (point))
+                          (emc-line-region
+                           (emc-get-region-mark region)
+                           (emc-get-region-point region)))))
 
           ((eq cmd 'evil-visual-char)
-           (setq region (if region nil
-                          (emc-refresh-region nil (point)))))
+           (setq region (if (and region (eq region-type 'char))
+                            nil
+                          (emc-refresh-region nil
+                                              (or (emc-get-region-prev-mark region)
+                                                  (point))))))
 
           (t (message "not implemented")))
     (emc-put-cursor-region cursor region)))


;; ((and (eq mark orig) (< (point) mark)) (setq mark (1+ mark)))

(defun emc-refresh-region (region orig)
  "Refresh the visual REGION when point moved from ORIG to current location."
  (let ((mark (emc-get-region-mark region)))
    ;; (message "mark %s orig %s point %s" mark orig (point))
    (unless mark (setq mark orig))
    (cond ((and (<= mark orig) (< (point) mark)) (setq mark (1+ mark)))
          ((and (< orig mark) (<= mark (point))) (setq mark (1- mark))))
    (cond ((< mark (point)) (emc-make-region-overlay mark (1+ (point))))
          ((< (point) mark) (emc-make-region-overlay mark (point)))
          (t (emc-make-region-overlay (point) (1+ (point)))))))

(defun emc-exchange-point-and-mark (region)
  "Exchange point and mark for a fake REGION."
  (let* ((mark (emc-get-region-mark region))
         (point (emc-get-region-point region)))
    (when region

(defun emc-get-region-point (region)
  "Return the REGION's point."
  (when region (overlay-get region 'point)))

(defun emc-get-region-prev-mark (region)
  "Return the REGION's prev mark."
  (when region (overlay-get region 'prev-mark)))

(defun emc-get-region-prev-point (region)
  "Return the REGION's prev point."
  (when region (overlay-get region 'prev-point)))

(defun emc-get-region-direction (region)
  "Return the direction of a visual region."
