Function: evil-with-restriction

evil-with-restriction is a macro defined in evil-common.el.

Signature

(evil-with-restriction BEG END &rest BODY)

Documentation

Execute BODY with the buffer narrowed to BEG and END.

BEG or END may be nil to specify a one-sided restriction.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defmacro evil-with-restriction (beg end &rest body)
  "Execute BODY with the buffer narrowed to BEG and END.
BEG or END may be nil to specify a one-sided restriction."
  (declare (indent 2) (debug t))
  `(save-restriction
     (let ((evil-restriction-stack
            (cons (cons (point-min) (point-max)) evil-restriction-stack)))
       (narrow-to-region (or ,beg (point-min)) (or ,end (point-max)))
       ,@body)))