add readme

This commit is contained in:
Kinneyzhang 2025-10-13 13:02:54 +08:00
parent bfc007e5d3
commit b23967c359
2 changed files with 25 additions and 4 deletions

21
readme.md Normal file
View File

@ -0,0 +1,21 @@
### text properties layer
- tp-layer-set (name start end &optional object)
- tp-layer-push (name start end properties &optional object)
- tp-layer-delete (name start end &optional object)
- tp-layer-rotate (start end &optional object)
- tp-layer-pin (name start end &optional object)
- tp-layer-define (name properties)
- tp-layer-group-define (name &rest layers)
### text properties propertize
- tp-propertize (string properties &optional layer)
- tp-layer-propertize (string layer)
- tp-layer-group-propertize (string layer-group)
### text properties search
- tp-forward (property &optional value predicate not-current)
- tp-backward (property &optional value predicate not-current)
- tp-forward-do (function property &optional value predicate not-current)
- tp-backward-do (function property &optional value predicate not-current)
- tp-regions-map (function property &optional value predicate collect)
- tp-strings-map (function property &optional value predicate collect)

8
tp.el
View File

@ -254,8 +254,8 @@ function 的四个参数分别为:区间开始位置,区间结束位置,顶
(value (prop-match-value match))) (value (prop-match-value match)))
(funcall function start end value))) (funcall function start end value)))
(defun tp-regions-map (defun tp-regions-map (function property &optional
(function property &optional value predicate collect) value predicate collect)
"对属性匹配的开头和结尾 point 执行 function。collect 为 t 时返回结果列表" "对属性匹配的开头和结尾 point 执行 function。collect 为 t 时返回结果列表"
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
@ -268,8 +268,8 @@ function 的四个参数分别为:区间开始位置,区间结束位置,顶
(cl-incf idx 1)) (cl-incf idx 1))
(nreverse lst)))) (nreverse lst))))
(defun tp-strings-map (defun tp-strings-map (function property &optional
(function property &optional value predicate collect) value predicate collect)
"对属性匹配的字符串执行 function" "对属性匹配的字符串执行 function"
(tp-regions-map (tp-regions-map
(lambda (start end idx) (lambda (start end idx)