Function: wgrep-commit-edits
wgrep-commit-edits is a natively compiled function defined in
wgrep.el.
Signature
(wgrep-commit-edits EDITOR)
Source Code
;; Defined in /nix/store/pbj4kr4ar755h56yscbqpnmv3swf8i1k-emacs-packages-deps/share/emacs/site-lisp/elpa/wgrep-20230203.1214/wgrep.el
(defun wgrep-commit-edits (editor)
(let ((file (car editor))
(edits (cdr editor)))
(wgrep-compute-linum-to-marker edits)
(let ((done 0)
(first-result nil)
(inhibit-read-only wgrep-change-readonly-file))
(dolist (edit edits)
(let ((marker (nth 0 edit))
(old (nth 1 edit))
(new (nth 2 edit))
(result-ov (nth 3 edit))
(edit-ov (nth 4 edit)))
(condition-case err
(progn
(unless first-result
(setq first-result result-ov))
(wgrep-apply-change marker old new)
(wgrep-put-done-result result-ov)
(delete-overlay edit-ov)
(setq done (1+ done)))
(error
(wgrep-put-reject-result result-ov (cdr err))))))
(cond
((or (not wgrep-auto-apply-disk)
(= done 0)))
(buffer-file-name
(basic-save-buffer))
(t
(let ((coding-system-for-write buffer-file-coding-system))
(write-region (point-min) (point-max) file nil 'no-msg))))
(list done first-result))))