Go to file
Kinneyzhang 958132f604
Some checks are pending
CI / test (push) Waiting to run
CI / native-build (macos-latest) (push) Waiting to run
CI / native-build (ubuntu-latest) (push) Waiting to run
CI / native-build (windows-latest) (push) Waiting to run
CI / native-msrv (macos-latest) (push) Waiting to run
CI / native-msrv (ubuntu-latest) (push) Waiting to run
CI / native-msrv (windows-latest) (push) Waiting to run
feat: support framework Host teardown
2026-09-01 01:07:23 +08:00
.github/workflows feat(ebox): project layouts into TP surface plans 2026-08-06 04:13:13 +08:00
docs feat: support framework Host teardown 2026-09-01 01:07:23 +08:00
native refactor: enforce canonical Text and Box runtime boundaries 2026-08-27 12:14:51 +08:00
scripts refactor: inject surface-free layout context for M2a E2 2026-08-31 20:37:08 +08:00
tests feat: support framework Host teardown 2026-09-01 01:07:23 +08:00
.gitignore perf: add native retained frame commits 2026-08-25 17:16:56 +08:00
AGENTS.md chore(ebox): checkpoint current implementation and docs 2026-08-11 20:43:40 +08:00
CHANGELOG.md perf: add native retained frame commits 2026-08-25 17:16:56 +08:00
CHANGELOG.zh-CN.md perf: add native retained frame commits 2026-08-25 17:16:56 +08:00
DESIGN.md feat: publish Ebox SPI v2 provider for M2a E5 2026-08-31 21:52:51 +08:00
DESIGN.zh.md feat: publish Ebox SPI v2 provider for M2a E5 2026-08-31 21:52:51 +08:00
ebox-buffer-backend.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-cache.el fix: restore immediate retained viewport updates 2026-08-26 00:09:53 +08:00
ebox-canonical.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-child-range.el refactor: own author facts behind opaque source handles 2026-08-28 16:48:09 +08:00
ebox-dsl.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-flex.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-font.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-fragment.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-grid.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-incremental.el refactor: add pure patch planner for M2a E3 2026-08-31 20:57:54 +08:00
ebox-layout-config.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-layout.el refactor: inject surface-free layout context for M2a E2 2026-08-31 20:37:08 +08:00
ebox-measure.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-native-commit.el fix: publish inherited native paint updates 2026-08-29 01:01:58 +08:00
ebox-native-reflow.el fix: publish inherited native paint updates 2026-08-29 01:01:58 +08:00
ebox-node-factory.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-patch-plan.el refactor: add pure patch planner for M2a E3 2026-08-31 20:57:54 +08:00
ebox-render-context.el refactor: inject surface-free layout context for M2a E2 2026-08-31 20:37:08 +08:00
ebox-selector.el refactor: own author facts behind opaque source handles 2026-08-28 16:48:09 +08:00
ebox-source.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-spi.el feat: support framework Host teardown 2026-09-01 01:07:23 +08:00
ebox-state-contract.el fix: complete M2a E1 retained-state inventory 2026-08-31 22:46:55 +08:00
ebox-style.el refactor: unify style schema truth for M2a E4 2026-08-31 21:25:19 +08:00
ebox-surface.el refactor: inject surface-free layout context for M2a E2 2026-08-31 20:37:08 +08:00
ebox-tree.el refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
ebox-viewport.el fix: restore immediate retained viewport updates 2026-08-26 00:09:53 +08:00
ebox.el feat: support framework Host teardown 2026-09-01 01:07:23 +08:00
Makefile feat: publish Ebox SPI v2 provider for M2a E5 2026-08-31 21:52:51 +08:00
README.md refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00
README.zh-CN.md refactor: unify canonical style and font projection 2026-08-28 22:06:30 +08:00

Ebox

Ebox is a standalone Text/Box layout engine for Emacs. It owns text measurement, box geometry, row/column/flex/Grid layout, retained rendering, and incremental buffer publication. Use the sibling ETAF package when an application also needs Components, reactive state, behaviors, or lifecycle.

Install

Ebox requires Emacs 29.1 or newer, ECSS, and TP. A package manager should install the declared dependencies. For sibling source checkouts, add the three directories to load-path, then load Ebox:

(add-to-list 'load-path "/path/to/ecss")
(add-to-list 'load-path "/path/to/tp")
(add-to-list 'load-path "/path/to/ebox")
(require 'ebox)

Loading Ebox does not create a buffer or build native code.

First render

The ordinary author model has seven entries: a string, text, box, row, column, flex, and grid. Children are nested directly; there is no second field-based child syntax.

(require 'ebox)

(ebox-render-to-buffer
 "*Ebox Example*"
 (ebox-build
  '(column :padding (1 2)
           :border (1 solid "#8A93A6")
           (text :color "#263244" "Hello Ebox")
           (row :item-gap 1
                (box "Left")
                (box "Right")))))

Use ebox-build for the public author DSL. Framework integrations may instead assemble typed nodes with one ebox-source-builder, then seal the forest and its source generation as one CanonicalEboxInput; that evaluated API is not a second author grammar.

Layout choices

  • box creates a normal visual box.
  • row and column provide simple one-axis composition.
  • flex distributes space and supports wrapping.
  • grid provides two-dimensional tracks and placement.
  • A bare string is the short form of (text "...").

Flex and Grid participation properties belong directly to a child box. They do not require a wrapper node.

Render and update

  • ebox-render returns propertized text without publishing a live buffer.
  • ebox-render-to-buffer mounts a retained surface.
  • ebox-commit atomically publishes a newly built canonical input.
  • ebox-buffer-update-report returns the last successful update report.
  • ebox-rerender-buffer-with-context applies an explicit viewport change.

Ebox copies canonical input before assigning runtime identity, so one built value may be mounted in multiple buffers without sharing live ownership.

Optional native module

The Rust module accelerates eligible reflow work. It is optional and has an exact Elisp fallback. Ebox never builds it while loading.

(ebox-native-status)
(ebox-native-build)

Verification

make load EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
make compile EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
make docs-contract-tests EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
make check EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
make native-rust-tests

See the user guide, the public API reference, and the sibling ebox-playground examples.