- Add tp--ensure-props helper to reduce code duplication
- Add nil check for group's first layer in tp--resolve-props
- Improve comments in tp--parse-args to explain the unwrapping logic
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
- Add tp--resolve-props helper function to resolve layer/group names to property lists
- Modify tp--parse-args to handle layer name symbols for tp-set, tp-reset, tp-add
- Update tp-match-set, tp-match-reset, tp-match-add to accept layer names
- Update tp-regexp-set, tp-regexp-reset, tp-regexp-add to accept layer names
- Update docstrings to document the new functionality
- Add comprehensive tests for all affected functions
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
- Updated tp-search-map signature to (function property &optional value object start end)
- Updated tp-forward-do signature to (function property &optional value object times start end)
- Updated tp-backward-do signature to (function property &optional value object times start end)
- Function callback for tp-search-map now accepts (text &optional start end idx)
- Function callback for tp-forward-do/tp-backward-do now accepts (text &optional start end)
- Updated internal helper functions tp--search-do, tp--forward-do, tp--backward-do
- Added new tests for the updated APIs
- Updated documentation in README.md and README_CN.md with examples
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
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>
The function parameter now supports optional second and third arguments:
- (function text) - backward compatible with existing code
- (function text start) - receives match start position
- (function text start end) - receives both start and end positions
This uses func-arity to detect how many arguments the function accepts
and passes the appropriate parameters.
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
Handle the case where max arity is 'many' (unlimited) for
variadic functions, in addition to numeric max arity.
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
The FUNCTION parameter in tp-search-map can now optionally accept a
second argument representing the 0-based index of the current match.
This is backwards compatible - functions that only accept one argument
continue to work as before.
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
store-substring only copies text content, not properties.
Added explicit property copying after store-substring to ensure
both text content and property modifications are applied.
Also updated tp-forward-do and tp-backward-do with the same fix.
Added test for property modification via tp-search-map.
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
Documented that for string objects, the replacement text must have the
same length as the original matched text due to store-substring limitations.
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
- tp-forward and tp-backward now support string objects
- Renamed tp-forward-do to tp--forward-do (private) with string support
- Renamed tp-backward-do to tp--backward-do (private) with string support
- New public tp-forward-do and tp-backward-do: function receives matched text only
- Renamed tp-search-do to tp--search-do (private)
- New public tp-search-map: function receives matched text only
- Updated English and Chinese documentation
- Updated and added tests for all new functionality
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
- Use with-current-buffer instead of set-buffer in tp-forward and tp-backward
- Fix tp-search documentation to correctly describe return type as list of (START END VALUE)
- Improve property detection in tp-search to handle falsy property values (0, nil, empty string)
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
- Modified tp-empty-p to support optional OBJECT parameter (nil = current buffer)
- Modified tp-plist to support two formats: (tp-plist start end &optional OBJECT) and (tp-plist string)
- Added tp-forward and tp-backward with new API (property &optional value object n)
- Added tp-forward-do and tp-backward-do for applying functions to matches
- Added tp-search for searching all matching properties in range or string
- Added tp-search-do for executing function on all matches
- Updated documentation (README.md and README_CN.md)
- Updated test cases (tp-tests.el)
- Removed obsolete function references (tp-next, tp-prev, tp-goto-next, tp-goto-prev, tp-in, tp-all, tp-regions-map, tp-strings-map)
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>