Function: evil-ex-call-command

evil-ex-call-command is a byte-compiled function defined in evil-ex.el.

Signature

(evil-ex-call-command RANGE COMMAND ARGUMENT)

Documentation

Execute the given command COMMAND.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-ex.el
(defun evil-ex-call-command (range command argument)
  "Execute the given command COMMAND."
  (when evil-ex-reverse-range
    (setq evil-ex-reverse-range nil)
    (unless (y-or-n-p "Backward range given, OK to swap? ")
      (user-error "")))
  (let* ((count (when (integerp range) range))
         (current-prefix-arg count)
         (evil-ex-range (if count (evil-ex-range count count) range))
         (cmd (evil-ex-completed-binding command))
         (evil-ex-bang (evil--ex-bang-p command))
         (evil-ex-argument argument)
         (evil-this-type (evil-type evil-ex-range))
         (evil-ex-point (point))
         (restore-point
          (and evil-ex-range
               (evil-get-command-property cmd :restore-point)
               (if (evil-visual-state-p) evil-visual-beginning evil-ex-point)))
         (evil-called-from-ex-p t))
    (evil-exit-visual-state)
    (deactivate-mark)
    (when evil-ex-range
      ;; Set region if an explicit range has been specified
      (cl-destructuring-bind (beg end &rest) (evil-expand-range evil-ex-range t)
        (goto-char beg)
        (set-marker (mark-marker) end)))
    (setq this-command cmd)
    (let ((mark-active evil-ex-range))
      (run-hooks 'pre-command-hook)
      (call-interactively cmd))
    (run-hooks 'post-command-hook)
    (when restore-point (goto-char restore-point))))