Function: projectile-replace--undo-valid-p
projectile-replace--undo-valid-p is a byte-compiled function defined
in projectile.el.
Signature
(projectile-replace--undo-valid-p EDITS)
Documentation
Return non-nil when EDITS still span exactly the text the replace wrote.
Checked against the current buffer. This is the guard that keeps an undo from corrupting a file that moved on since the replace: unless every recorded span still holds the written text, verbatim, the file is left alone.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
;;; Undoing the last applied replace
(defun projectile-replace--undo-valid-p (edits)
"Return non-nil when EDITS still span exactly the text the replace wrote.
Checked against the current buffer. This is the guard that keeps an undo
from corrupting a file that moved on since the replace: unless every
recorded span still holds the written text, verbatim, the file is left
alone."
(cl-every (lambda (e)
(let* ((beg (projectile-replace--undo-edit-beg e))
(new (projectile-replace--undo-edit-new e))
(end (+ beg (length new))))
(and (<= (point-min) beg end (point-max))
(string= (buffer-substring-no-properties beg end) new))))
edits))