Function: eca-rewrite--clone-buffer-with-rewrite

eca-rewrite--clone-buffer-with-rewrite is a natively compiled function defined in eca-rewrite.el.

Signature

(eca-rewrite--clone-buffer-with-rewrite OV NAME)

Documentation

Return a clone of the buffer NAME with the rewrite overlay OV applied.

Source Code

;; Defined in /nix/store/jklqzw6pzz6j4jrbv8wy0iwgi7jlrbld-emacs-packages-deps/share/emacs/site-lisp/elpa/eca-20260928.1827/eca-rewrite.el
(defun eca-rewrite--clone-buffer-with-rewrite (ov name)
  "Return a clone of the buffer NAME with the rewrite overlay OV applied."
  (let ((buf (overlay-buffer ov)))
    (with-current-buffer buf
      (let ((min (point-min))
            (max (point-max))
            (pt  (point))
            (newb (get-buffer-create name)))
        (save-restriction
          (widen)
          (with-current-buffer newb
            (erase-buffer)
            (insert-buffer-substring buf)))
        (with-current-buffer newb
          (narrow-to-region min max)
          (goto-char pt)
          (eca-rewrite--accept ov))
        newb))))