Function: evil-interactive-string

evil-interactive-string is a byte-compiled function defined in evil-common.el.

Signature

(evil-interactive-string STRING)

Documentation

Evaluate the interactive string STRING.

The string may contain extended interactive syntax. The return value is a cons cell (FORM . PROPERTIES), where FORM is a single list-expression to be passed to a standard interactive statement, and PROPERTIES is a list of command properties as passed to evil-define-command.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defun evil-interactive-string (string)
  "Evaluate the interactive string STRING.
The string may contain extended interactive syntax.
The return value is a cons cell (FORM . PROPERTIES),
where FORM is a single list-expression to be passed to
a standard `interactive' statement, and PROPERTIES is a
list of command properties as passed to `evil-define-command'."
  (let ((len (length string))
        (pos 0)
        forms properties)
    (while (< pos len)
      (if (eq (aref string pos) ?\n)
          (setq pos (1+ pos))
        (cl-destructuring-bind (code expr . plist)
            (or (evil-match-interactive-code string pos)
                (user-error "Unknown interactive code: `%s'"
                            (substring string pos)))
          (setq pos (+ pos (length code)))
          (when (functionp expr)
            (let ((prompt (substring
                           string pos
                           (or (string-match-p "\n" string pos) len))))
              (setq pos (+ pos (length prompt))
                    expr `(funcall ,expr ,prompt))))
          (setq forms (append forms (list expr))
                properties (append properties plist)))))
    (cons `(append ,@forms) properties)))