Fix tp-forward-do / tp-backward-do to execute function on all matches

Remove erroneous `t` predicate argument from tp-search-forward calls
that caused text-property-search-forward to find regions where the
property value CHANGES rather than regions where the property is SET.

Fixes issue: tp-forward-do / tp-backward-do 只在最后一次执行 function

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-12-15 17:00:09 +00:00
parent 33cb4de2a4
commit 33ca6b520a

4
tp.el
View File

@ -951,7 +951,7 @@ Uses `tp-search-forward' for buffers and `tp-search' for strings."
(buf (or object (current-buffer)))) (buf (or object (current-buffer))))
(with-current-buffer buf (with-current-buffer buf
(dotimes (_ count) (dotimes (_ count)
(setq result (tp-search-forward property value t)))) (setq result (tp-search-forward property value))))
result))))) result)))))
(defun tp-backward (property &optional value object n) (defun tp-backward (property &optional value object n)
@ -1012,7 +1012,7 @@ Returns the number of successful matches."
(save-excursion (save-excursion
(when point (goto-char point)) (when point (goto-char point))
(dotimes (_ count) (dotimes (_ count)
(when-let ((match (tp-search-forward property value t))) (when-let ((match (tp-search-forward property value)))
(funcall function match buf) (funcall function match buf)
(cl-incf matches))))) (cl-incf matches)))))
matches))))) matches)))))