From 7357ac120f7ad5efdd2845745bfd9675f99f691e Mon Sep 17 00:00:00 2001 From: Kinneyzhang Date: Mon, 15 Dec 2025 15:24:08 +0800 Subject: [PATCH] delete unused code --- tp.el | 45 ++------------------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/tp.el b/tp.el index 7121d47..b3f0b11 100644 --- a/tp.el +++ b/tp.el @@ -1460,57 +1460,16 @@ OBJECT defaults to current buffer." ;;; Search functions -(defun tp-forward (property &optional value predicate not-current) +(defun tp-search-forward (property &optional value predicate not-current) "Search forward for text with PROPERTY. VALUE, PREDICATE, and NOT-CURRENT work as in `text-property-search-forward'." (text-property-search-forward property value predicate not-current)) -(defun tp-backward (property &optional value predicate not-current) +(defun tp-search-backward (property &optional value predicate not-current) "Search backward for text with PROPERTY. VALUE, PREDICATE, and NOT-CURRENT work as in `text-property-search-backward'." (text-property-search-backward property value predicate not-current)) -(defun tp-forward-do (function property &optional value predicate not-current) - "Search forward for PROPERTY and apply FUNCTION to the match. -FUNCTION receives three arguments: START, END, and VALUE." - (when-let* ((match (tp-forward property value predicate not-current)) - (start (prop-match-beginning match)) - (end (prop-match-end match)) - (val (prop-match-value match))) - (funcall function start end val))) - -(defun tp-backward-do (function property &optional value predicate not-current) - "Search backward for PROPERTY and apply FUNCTION to the match. -FUNCTION receives three arguments: START, END, and VALUE." - (when-let* ((match (tp-backward property value predicate not-current)) - (start (prop-match-beginning match)) - (end (prop-match-end match)) - (val (prop-match-value match))) - (funcall function start end val))) - -(defun tp-regions-map (function property &optional value predicate collect) - "Apply FUNCTION to all regions with PROPERTY in current buffer. -FUNCTION receives three arguments: START, END, and INDEX. -If COLLECT is non-nil, return list of results." - (save-excursion - (goto-char (point-min)) - (let ((idx 0) lst) - (while-let ((match (tp-forward property value predicate)) - (start (prop-match-beginning match)) - (end (prop-match-end match))) - (let ((res (funcall function start end idx))) - (when collect (push res lst))) - (cl-incf idx 1)) - (nreverse lst)))) - -(defun tp-strings-map (function property &optional value predicate collect) - "Apply FUNCTION to all strings with PROPERTY in current buffer. -FUNCTION receives two arguments: STRING and INDEX." - (tp-regions-map - (lambda (start end idx) - (funcall function (buffer-substring start end) idx)) - property value predicate collect)) - ;;; Match and regexp functions (similar to ov-match and ov-regexp) (defun tp--match-apply (pattern properties apply-fn &optional object)