Commit Graph

362 Commits

Author SHA1 Message Date
Kinneyzhang
319109ef54 Merge remote-tracking branch 'origin/copilot/update-tp-el-external-properties' 2026-01-06 04:08:58 +08:00
Kinneyzhang
e6a14e124f update 2026-01-06 04:08:26 +08:00
copilot-swe-agent[bot]
a75820dc20 Initial plan 2026-01-05 19:59:21 +00:00
copilot-swe-agent[bot]
3e5773c2a2 Fix face sub-property merging in tp-add and tp--merge-face-values
When face values contain mixed lists (symbols and plists like
(bold (:foreground "green"))), the plist parts are now correctly
merged with earlier plists. This ensures that later values for
the same sub-property (like :foreground) properly override earlier
values without creating duplicates.

Example that now works correctly:
(tp-add
  (tp-add
    (tp-set "emacs" 'face 'bold)
    'face '(:foreground "red"))
  'face '(bold (:foreground "green")))
=> face is (bold (:foreground "green")) instead of
   (bold (:foreground "green") (:foreground "red"))

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 19:29:59 +00:00
copilot-swe-agent[bot]
39bbd6b431 Address code review feedback
- Fix tp--equal-including-string-properties to only use
  equal-including-properties when BOTH args are strings
- Improve test to use (point-min) and (point-max) instead of
  hardcoded positions

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 19:18:50 +00:00
copilot-swe-agent[bot]
45268b6e5a Fix duplicate foreground property in face when updating tp-text
Changed from using tp-add to set-text-properties when text content is
same but properties differ. This prevents duplicate property merging
since merged-props already contains the complete set of properties.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 19:16:19 +00:00
copilot-swe-agent[bot]
467a4c16f4 Fix tp-text to update when text properties differ even if text is same
- Added `tp--equal-including-string-properties` helper function that uses
  `equal-including-properties` for strings to properly detect changes in
  text properties when the text content is the same
- Updated `tp--reactive-variable-watcher` to use this new comparison function
- Updated `tp--replace-reactive-text-in-buffer` to use `tp-add` when text
  content is the same but properties may differ
- Added test `tp-test-tp-text-same-text-different-properties` to verify
  the fix

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 19:14:59 +00:00
copilot-swe-agent[bot]
cdc14f3759 Initial plan 2026-01-05 19:06:34 +00:00
copilot-swe-agent[bot]
d3679eccad Support mixed face list format like (bold :foreground "green")
Added tp--parse-face-list helper function to parse mixed face lists
that contain both symbols and inline plist keys/values:
- (bold :foreground "green") -> symbols: (bold), plist: (:foreground "green")
- (bold (:foreground "green")) -> symbols: (bold), plist: (:foreground "green")
- (:foreground "green") -> symbols: nil, plist: (:foreground "green")

Updated tp--merge-face-values to use this helper when merging face lists.

Added test case for mixed format to tp-test-tp-add-face-override-subprops.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 18:39:08 +00:00
copilot-swe-agent[bot]
a140fd8b45 Fix tp-add to override embedded face sub-properties with new values
When tp-add merges face properties, new props values should now
override embedded values for the same sub-properties (e.g., if
new face has :foreground "green" and embedded has :foreground "red",
result should be :foreground "green").

Updated tp--merge-string-props-into-plist to pass props as the
override value when merging faces.

Updated tp--merge-face-values to properly handle mixed face lists
(symbols + plists) when the base face is a plist.

Added test tp-test-tp-add-face-override-subprops to verify this behavior.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 18:31:06 +00:00
copilot-swe-agent[bot]
c1210185e1 Preserve correct semantics for tp-set, tp-add, tp-reset with tp-text
- tp-set: props override embedded text properties in tp-text value
- tp-add: props are merged with embedded text properties
- tp-reset: embedded properties are ignored, only props used

Added merge-mode parameter to tp--handle-tp-text-property:
- :override - props take precedence (tp-set)
- :merge - embedded props merged with props (tp-add)
- :reset - embedded props ignored (tp-reset)

Updated tests to reflect correct semantics.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 18:18:28 +00:00
copilot-swe-agent[bot]
281d1c92a3 Simplify tp-text property merging implementation
- Add tp--merge-string-props-into-plist to merge embedded properties
  from tp-text value into props plist with proper face merging
- Simplify tp--handle-tp-text-property to use the new merge function
  and return merged props directly
- Simplify tp-set, tp-reset, tp-add by removing marker-based handling
- Fix tp-add to avoid duplicate face merging for strings with tp-text
- Remove unused tp--apply-string-props-to-region and
  tp--remove-internal-markers functions
- Update tests to match the simplified implementation

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 17:57:34 +00:00
copilot-swe-agent[bot]
6f61f5a457 Refactor: simplify tp--string-has-properties-p and extract helper
- Remove unnecessary length check in tp--string-has-properties-p since
  object-intervals handles empty strings correctly
- Extract tp--remove-internal-markers helper to reduce code duplication
  across tp-set, tp-reset, and tp-add functions

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 17:33:35 +00:00
copilot-swe-agent[bot]
ebe0922c9c Fix tp-text property detection to scan entire string
Use tp--string-has-properties-p helper function instead of checking
only position 0. This properly detects text properties that start at
non-zero positions in the string.

Added test tp-test-tp-text-with-properties-starting-at-nonzero to
verify this fix.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 17:30:02 +00:00
copilot-swe-agent[bot]
933acf0292 Support text properties within tp-text values
- Modify tp--handle-tp-text-property to detect and preserve embedded text
  properties in tp-text values for both strings and buffers
- Add tp--apply-string-props-to-region helper to apply string properties
- Update tp-set, tp-reset, tp-add to preserve embedded tp-text properties
  by using put-text-property instead of set-text-properties when needed
- Update tp--replace-reactive-text-in-buffer to preserve embedded properties
- Add tests for tp-text with embedded text properties

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 17:27:01 +00:00
copilot-swe-agent[bot]
2df9f3f323 Initial plan 2026-01-05 17:16:52 +00:00
Kinneyzhang
65a438c773 update 2026-01-06 00:11:14 +08:00
Kinneyzhang
edfb7b2e35 update 2026-01-05 20:20:12 +08:00
copilot-swe-agent[bot]
d11d109f7b Fix "Odd length text property list" error when property value is nil
The bug occurred because tp--parse-args was incorrectly omitting nil values
from the property list, producing (face) instead of (face nil).

Fixed the same bug pattern in:
- tp--parse-args (used by tp-set, tp-reset, tp-add)
- tp-add-to-layers
- tp-add-to-all-layers

Added 6 new regression tests for nil property values.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-05 09:52:26 +00:00
copilot-swe-agent[bot]
4cca06dedc Initial plan 2026-01-05 09:44:15 +00:00
Kinneyzhang
ec1619e047 update 2026-01-05 17:43:34 +08:00
Kinneyzhang
63b58c6cf5 update tp-palette.el 2026-01-05 17:29:20 +08:00
copilot-swe-agent[bot]
d7e54e3b3d docs: separate custom text properties and text property layers introduction
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 13:55:50 +00:00
copilot-swe-agent[bot]
01451f44ee Initial plan 2026-01-04 13:52:01 +00:00
copilot-swe-agent[bot]
f9c0867d63 Update docs directory to use define-tp and define-tps format
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 13:36:16 +00:00
copilot-swe-agent[bot]
7e0a8573da Update documentation with parameterized layer group examples
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 13:25:54 +00:00
copilot-swe-agent[bot]
93f61e5ba0 Fix tp-intervals to handle 1-based buffer positions correctly
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 13:10:55 +00:00
copilot-swe-agent[bot]
b58065293b Fix define-tps to set multi-layer properties with tp-layers structure
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 12:54:36 +00:00
copilot-swe-agent[bot]
a481327727 Add support for parameterized layer groups (define-tps with arg)
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 12:38:58 +00:00
copilot-swe-agent[bot]
e277b1e999 Remove support for parameterized reactive layers (Format 4), only allow :props/:data etc with $-prefixed variables
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 12:01:26 +00:00
copilot-swe-agent[bot]
c7db648e85 Fix tp-layer-props-with-arg to handle reactive parameterized layers
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 11:45:53 +00:00
copilot-swe-agent[bot]
7934749397 Complete refactoring: remove tp-define-layer and tp-define-layer-group, use only define-tp and define-tps
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 11:35:30 +00:00
copilot-swe-agent[bot]
4607f50a13 Add reactive features support (:props, :data, :compute, :watch, :transform) to define-tp macro
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 11:16:53 +00:00
copilot-swe-agent[bot]
5667881765 Fix tp-group-props to handle both old and new formats, update remaining documentation examples
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 10:31:52 +00:00
copilot-swe-agent[bot]
5f55263eb2 Update English README.md documentation to use define-tp/define-tps format
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 10:28:07 +00:00
copilot-swe-agent[bot]
fdaa2b0c54 Refactor tp-define-layer to define-tp/define-tps format with updated tests and documentation
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-04 10:23:47 +00:00
copilot-swe-agent[bot]
f7df396a15 Initial plan 2026-01-04 10:06:23 +00:00
Kinneyzhang
a1c4fa0151 update 2026-01-03 00:11:47 +08:00
Kinneyzhang
82c226e777 update 2026-01-02 19:41:11 +08:00
copilot-swe-agent[bot]
9a65f85fe8 Fix property merging when combining custom layers with built-in properties
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-01 17:09:37 +00:00
copilot-swe-agent[bot]
04feef0433 Add automatic property merging for duplicate keys in single call
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-01 16:49:16 +00:00
copilot-swe-agent[bot]
adb56bd01d Initial plan 2026-01-01 16:40:10 +00:00
copilot-swe-agent[bot]
3410e28dac feat: add recursive resolution for nested custom layer properties
When a define-tp layer returns a plist containing other custom layer names,
those are now recursively expanded to their built-in text properties.

This fixes the issue where tp-button using tp-palette internally would
leave tp-palette as a text property instead of resolving it to the
actual face properties.

Changes:
- Added tp--plist-has-layer-key-p helper function
- Updated tp--expand-layer-in-plist to recursively expand layer props
- Updated tp-layer-props to expand nested layers in returned plist
- Updated tp-layer-props-with-arg to expand nested layers in returned plist
- Added 3 tests for nested layer resolution

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2025-12-31 08:15:32 +00:00
copilot-swe-agent[bot]
d824de77ee Initial plan 2025-12-31 08:03:05 +00:00
Kinneyzhang
3be28a7362 update 2025-12-31 16:02:30 +08:00
copilot-swe-agent[bot]
95f0f3d702 Add documentation for :transform, batch updates, and debug mode in English and Chinese
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2025-12-31 07:29:18 +00:00
copilot-swe-agent[bot]
c20c1efb54 Initial plan 2025-12-31 07:19:57 +00:00
Kinneyzhang
6ffef7932c update 2025-12-31 15:17:17 +08:00
Kinneyzhang
352977b4fe improve code 2025-12-31 00:18:48 +08:00
copilot-swe-agent[bot]
197a564733 Improve documentation and add error handling for palette utility functions
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2025-12-30 16:00:49 +00:00