Commit Graph

192 Commits

Author SHA1 Message Date
Kinneyzhang
c05174ff9d refactor!: publish transactions exclusively through protocol v2 2026-09-05 05:25:29 +08:00
Kinneyzhang
25cb66c040 feat(transaction): expose structured participant registration 2026-09-01 15:52:05 +08:00
Kinneyzhang
469bdff17d feat(transaction): cut over to structured publication authority 2026-09-01 15:37:29 +08:00
Kinneyzhang
2e2d9edc84 fix(package): distinguish transaction-capable TP 2026-09-01 05:57:28 +08:00
Kinneyzhang
76be75f674 feat: add TP v1+v2 transaction contract 2026-08-31 19:35:02 +08:00
Kinneyzhang
0d35358e05 refactor(tp)!: implement retained reactive runtime
Replace the legacy managed layer renderer with one independent retained/reactive text runtime. TP now owns exact dependencies, stable objects, marker-backed mounts, property contribution composition, atomic publication, rollback, and direct text-property facades without ECSS or Ebox dependencies.\n\nBREAKING CHANGE: remove tp-render, tp-stack, scan-driven managed layers, inline runtime metadata, TP-owned CSS cascade APIs, and dollar-variable declarations.\n\nVerified: 290/290 ERT, shuffled 290/290 (seed 20260806), 8/8 doctests, WERROR compile-all, checkdoc, package-lint, diff-check, and isolated TP-only load.
2026-08-07 00:39:50 +08:00
Kinneyzhang
84ebf0a548 feat(tp): add retained surfaces and atomic publication
Introduce pure retained plans, stable objects, marker-backed range ownership, side indexes, content/property diffs, and multi-buffer rollback as the generic publication runtime.

Verification: 707 ERT tests; 92 doctests; shuffled seed 20260806; compile-all WERROR=t.
2026-08-06 03:23:59 +08:00
Kinneyzhang
183f49ed3e feat(tp): replace scan reactivity with binding graph
Introduce exact signal and binding dependencies, transactional scheduling, rollback, cycle detection, scoped variable adapters, owner disposal, and scheduler counters. Keep the legacy scanner isolated until retained surfaces complete the cutover.\n\nVerified: 681 ERT tests, 92 doctests, shuffled ERT seed 20260806, and WERROR byte compilation.
2026-08-06 02:36:11 +08:00
Kinneyzhang
ef31a67beb feat(tp): add schema-driven cascade engine
Introduce the pure TP 1.0 property schema, selector, cascade, custom-property, computed-value, provenance, and Emacs projection kernel. Compile static legacy layer definitions into canonical named styles without freezing parameterized or reactive definitions.\n\nVerified with 667 ERT tests, 92 doctests, shuffled seed 20260806, and compile-all with warnings as errors.
2026-08-06 02:12:32 +08:00
Kinneyzhang
972b6d4e4c Complete text-property facade and managed lifecycle
Add canonical query semantics, managed metadata and transactions, overlay-aware lookup, reproducible benchmarks, and synchronized API documentation.
2026-07-28 22:42:55 +08:00
Kinneyzhang
7f0da36ada Bump version to 0.3.0; start changelog with the infrastructure work
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-27 00:12:22 +08:00
Kinneyzhang
5e5017a726 Split tp.el monolith into layered modules (behavior-preserving)
tp.el (4866 lines) is now an umbrella over nine modules with an
enforceable dependency order: tp-core -> tp-reactive -> tp-layer ->
tp-ops -> tp-search -> tp-render -> tp-stack -> tp-palette ->
tp-builtins.  Upward dependencies are inverted through four hook
variables installed by tp-render.el.

Also: require text-property-search (fixes tp-backward void-function),
clip tp-intervals to the requested range, add the shared clipping
interval walker tp--map-intervals and tp-face-properties, remove
synced-conflict junk files, byte-compilation now succeeds (define-tp
macroexpansion previously failed at compile time).

All 280 legacy tests pass plus 8 new tp-core tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-26 17:13:44 +08:00
Kinneyzhang
29b2ee54d3 update 2026-01-13 18:11:40 +08:00
Kinneyzhang
a1ce94c0dd add heatmap tp-palette 2026-01-08 15:48:34 +08:00
copilot-swe-agent[bot]
6b96d8575f Simplify reactive text replacement to directly reset properties with new values
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-08 03:43:55 +00:00
copilot-swe-agent[bot]
7d7979c54c Revert changes to tp--replace-reactive-text-in-buffer to fix checkbox strikethrough toggle
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-08 03:17:05 +00:00
copilot-swe-agent[bot]
89d76fa0cc Address code review feedback: improve docstring and null handling
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-08 03:00:59 +00:00
copilot-swe-agent[bot]
3a0f774c70 Optimize tp--replace-reactive-text-in-buffer to preserve all original text properties
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-08 02:58:45 +00:00
Kinneyzhang
041f53025e fix tp 'pointer 'hander 2026-01-08 10:43:21 +08:00
copilot-swe-agent[bot]
9d97430d62 Improve documentation for merge-mode parameter in tp--handle-tp-text-property
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-07 09:24:35 +00:00
copilot-swe-agent[bot]
148b255456 Fix tp-reset and tp-set to preserve embedded text properties from tp-text
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-07 09:22:32 +00:00
copilot-swe-agent[bot]
710e52c67f Fix tp-parse-color to handle unknown background-mode
When (frame-parameter nil 'background-mode) returns nil (e.g., in
batch mode or certain configurations), both tp-theme-light-p and
tp-theme-dark-p return nil, causing color parsing to fail for
cons cell ("light" . "dark") and plist (:light "l" :dark "d") formats.

Added default fallback to light color when background-mode is unknown.
This is the root cause of tp-palette settings not taking effect.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-07 03:51:28 +00:00
copilot-swe-agent[bot]
347abb601e Improve tp--apply-props-to-string to handle partial range correctly
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-07 03:26:47 +00:00
copilot-swe-agent[bot]
6392be848e Fix: Use propertize directly to preserve text property intervals
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-07 03:23:08 +00:00
copilot-swe-agent[bot]
fe0594c575 Fix: tp-match-set and tp-regexp-set now create a copy instead of modifying original string
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-07 03:00:25 +00:00
Kinneyzhang
4dff70cd59 improve code 2026-01-07 02:20:38 +08:00
copilot-swe-agent[bot]
aa53dc1b99 Improve variable naming: rename face-to-subtract to remaining-face for clarity
Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-06 18:04:21 +00:00
copilot-swe-agent[bot]
18b85e446a Fix duplicate function name and test corrections
- Rename second tp--remove-nested-keys to tp--remove-nested-sub-keys
- Fix logic in tp--remove-props-from-string to properly handle nil face subtraction result
- Fix tests to properly use return values from tp-set and tp-remove
- Add face-was-modified tracking variable

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-06 18:02:35 +00:00
copilot-swe-agent[bot]
b062eb30fd Fix tp-remove for custom layers and complex face sub-properties
- Add tp--remove-sub-from-face-value to handle complex face structures
- Add tp--subtract-face-from-face-value to remove layer face contributions
- Add tp--get-layer-face-contribution helper function
- Update tp--remove-props-from-string to handle layer face subtraction
- Update tp--remove-sub-from-string to use new helper
- Update tp--expand-layer-to-props-list to detect layer properties
- Fix missing closing paren in tp--remove-property function
- Update tests to match expected behavior

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-06 17:52:57 +00:00
Kinneyzhang
25a8daa36e Merge remote-tracking branch 'origin/copilot/optimize-string-properties' 2026-01-07 01:15:18 +08:00
Kinneyzhang
f28c9ba7b3 fix bug 2026-01-07 01:15:16 +08:00
copilot-swe-agent[bot]
6ee2473327 Support layer name removal in tp-remove for custom text properties
When tp-remove is called with a layer name (defined with define-tp),
it now correctly identifies and removes all properties that the layer
adds, plus the tp-name property.

Example:
  (define-tp tp-delete (color)
    `(face (:strike-through ,color)))

  (let ((str "emacs"))
    (setq str (tp-set str 'face 'bold 'tp-delete t))
    (insert (tp-remove str 'tp-delete)))

Changes:
- Added tp--expand-layer-to-props-list helper function
- Added tp--expand-props-to-remove helper function
- Modified tp--remove-props-from-string to expand layer names
- Modified tp--remove-property for buffer regions to handle layer names
- Added tests for custom layer removal

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-06 17:13:22 +00:00
copilot-swe-agent[bot]
a48a523120 Address code review: improve pattern matching and readability
- Collect all match positions before applying transformations to avoid
  string-match position invalidation issues
- Use list* instead of nested cons for better readability
- Improve plist building efficiency by iterating instead of copy-sequence
- Add detailed comment explaining :reset mode usage with tp-text

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-06 16:24:35 +00:00
copilot-swe-agent[bot]
98f807993a Refine string modification behavior: region form modifies in-place, entire string form creates copy
Updated the implementation to clearly distinguish:
- (tp-set/add/reset START END PROPS STRING): Modifies original string in-place
- (tp-set/add/reset "string" PROP VAL ...): Creates NEW string using propertize

Also fixed code review issues:
- Removed unused 'offset' variable
- Made tp--remove-nested-keys non-destructive

Updated documentation with detailed behavior table and examples.

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-06 16:18:38 +00:00
copilot-swe-agent[bot]
70f60f1a25 Use propertize for non-destructive string operations in tp-set/add/reset/remove
This change makes tp-set, tp-add, tp-reset, and tp-remove return a NEW
propertized string when operating on strings, rather than modifying the
original string in-place. This is more idiomatic for Emacs Lisp and
prevents unintended side effects.

For buffer operations, the existing in-place modification behavior is
preserved.

Key changes:
- Added tp--apply-props-to-string helper function that uses propertize
- Updated tp-set, tp-add, tp-reset to use the new helper for strings
- Updated tp-remove with new helper functions for non-destructive removal
- Updated tp--match-apply and tp--regexp-apply to accumulate changes
- Added tests verifying original strings are not modified
- Updated documentation to reflect the new behavior

Co-authored-by: Kinneyzhang <38454496+Kinneyzhang@users.noreply.github.com>
2026-01-06 16:05:58 +00:00
Kinneyzhang
e6a14e124f update 2026-01-06 04:08:26 +08: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]
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
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