Function: evil-read-motion

evil-read-motion is a byte-compiled function defined in evil-common.el.

Signature

(evil-read-motion &optional MOTION COUNT TYPE MODIFIER)

Documentation

Read a MOTION, motion COUNT and motion TYPE from the keyboard.

The type may be overridden with MODIFIER, which may be a type or a Visual selection as defined by evil-define-visual-selection. Return a list (MOTION COUNT [TYPE]).

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defun evil-read-motion (&optional motion count type modifier)
  "Read a MOTION, motion COUNT and motion TYPE from the keyboard.
The type may be overridden with MODIFIER, which may be a type
or a Visual selection as defined by `evil-define-visual-selection'.
Return a list (MOTION COUNT [TYPE])."
  (let (command prefix)
    (setq evil-this-type-modified nil)
    (unless motion
      (while (progn
               (setq command (evil-keypress-parser)
                     motion (pop command)
                     prefix (pop command))
               (when prefix
                 (setq count
                       (if count
                           (string-to-number
                            (concat (number-to-string count)
                                    (number-to-string prefix)))
                         prefix)))
               ;; if the command is a type modifier, read more
               (when (rassq motion evil-visual-alist)
                 (setq modifier
                       (or modifier
                           (car (rassq motion evil-visual-alist))))))))
    (when modifier
      (setq type (or type (evil-type motion 'exclusive)))
      (cond
       ((eq modifier 'char)
        ;; TODO: this behavior could be less hard-coded
        (setq type (if (eq type 'exclusive) 'inclusive 'exclusive)))
       (t (setq type modifier)))
      (setq evil-this-type-modified type))
    (list motion count type)))