Display Org tables as responsive, pixel-aligned widgets inside ordinary Org buffers, powered by TextUI.
- Align mixed CJK, Latin text, emoji and inline code using pixel widths.
- Wrap long cells and reflow after window resizing or text scaling.
- Preserve Org cell faces and links; support
<l>,<c>and<r>alignment, horizontal separators, Unicode/ASCII borders and alternating row backgrounds. - Hide alignment and column-group declaration rows from the rendered table.
Rendering uses overlays, leaving the source table intact for Org editing,
export, formulas and Babel. Point stops on each row of a table as on a single
character, with the cursor on the row's top-left corner; press e there to
reveal the source, and move out to render it again.
The cursor-entry correction for moving upward into a table preview is adapted from karthink's org-latex-preview fix. Thanks to karthink for the fix and for explaining the multi-line preview edge case.
Emacs 29.1+, Org 9.6+, TextUI 0.8.0+,
and a graphical Emacs frame for rendered widgets by default. In a terminal,
the mode can be enabled, but automatic rendering is skipped and tables stay as
editable Org source unless org-table-widget-enable-in-terminal is non-nil.
Terminal rendering is much slower to enable on large tables. After the terminal is resized, tables are laid out again on the next key press. Alignment of emoji rows may depend on the terminal emulator.
Not on MELPA yet. Install TextUI first, then this package:
(require 'package-vc)
(package-vc-install "https://github.com/yibie/textui")
(package-vc-install "https://github.com/yibie/org-table-widget" "v0.3.1")Alternatively, clone both repositories and add their directories manually:
(add-to-list 'load-path "/path/to/textui")
(add-to-list 'load-path "/path/to/org-table-widget")
(require 'org-table-widget)Enable automatically in Org buffers:
(require 'org-table-widget)
(add-hook 'org-mode-hook #'org-table-widget-mode)Use M-x org-table-widget-mode to enable or disable it in the current buffer,
M-x org-table-widget-toggle to reveal or render the table at point, and
M-x org-table-widget-refresh to refresh the buffer's tables.
Line and character motion stop on each row of a rendered table, so long tables
can be walked through and scrolled like ordinary text. With point on a row,
press e (org-table-widget-edit) to edit the table's Org source, starting on
that row's line; the table is rendered again once point leaves it. Searches that land inside a
table reveal it too. Keys on a table come from org-table-widget-map.
When a table's header, the rows above its first horizontal rule, scrolls out of
view while the rest of the table is still on screen, the window's header line
shows it, aligned with the columns below. The header line holds one line, so a
header that wraps or spans several rows shows only its first line. Any other
header line comes back once the header scrolls into view again. The sticky
header makes scrolling through large tables noticeably less smooth; set
org-table-widget-sticky-header to nil if that matters more.
Customize with M-x customize-group RET org-table-widget RET.
| Option | Default | Meaning |
|---|---|---|
org-table-widget-use-unicode-borders |
t |
Use Unicode borders; nil selects ASCII. |
org-table-widget-enable-in-terminal |
nil |
Render table widgets on text terminals as well. |
org-table-widget-zebra-stripe |
t |
Alternate data-row backgrounds. |
org-table-widget-wrap-columns |
t |
Wrap cell content; nil uses natural widths. |
org-table-widget-max-width-fraction |
1.0 |
Fraction of the window body width available to the table. |
org-table-widget-relayout-delay |
0.15 |
Idle seconds before resize relayout; zero or negative means immediate. |
org-table-widget-reveal-on-point |
nil |
Reveal source as soon as point enters a table, without e. |
org-table-widget-sticky-header |
t |
Keep a scrolled-off table header in the header line. |
org-table-widget-cell-properties |
(face font-lock-face invisible display mouse-face help-echo keymap follow-link htmlize-link org-emphasis) |
Text properties retained in rendered cells. |
org-modern: Setorg-modern-tabletonilso the two packages do not style the same table. Non-table styling has been smoke-tested in both mode-enabling orders, including throughorg-mode-hook, with Emacs 31.0.91, Org 9.8.7 and org-modern 1.15. A reported load-order conflict has not yet been reproduced; please include package versions and a minimal configuration when reporting it.visual-line-mode: Cursor motion is tested with the mode both enabled and disabled: Down and Up stop on the table, then step past it. Withorg-table-widget-reveal-on-point, Down reveals the first source row and Up the last. A narrow-window layout smoke test also passed with the mode enabled. This does not eliminate the minimum-width overflow limitation noted below.
org-table-widget and Valign share a basic
promise: both use pixel measurements to align tables without rewriting their
source text. They work at different layers. Valign visually aligns the existing
table in place. org-table-widget covers the source with a separate, responsive
rendering and reveals the source when it is time to edit.
| Capability | org-table-widget |
Valign |
|---|---|---|
| Display model | Builds a block widget and covers the source table with an overlay. | Adds display properties and overlays to spaces and separators in the existing table. |
| Table formats | Org pipe tables. | Org, Markdown and table.el tables. |
| Editing | Reveals the ordinary Org source when e is pressed on the table, then renders it again when point leaves. |
Keeps the visually aligned source visible and editable. |
| Mixed-width text | Pixel-aligns CJK, Latin text, emoji and inline code inside a fixed-pitch table. | Pixel-aligns the table as displayed, including variable-pitch text, CJK and images. |
| Narrow windows | Allocates columns within the window budget, wraps cell content and reflows after resizing. | Keeps cells on one source line at their natural width; it does not provide responsive cell wrapping. |
| Alignment | Supports explicit <l>, <c> and <r> Org cookies, including centered cells. |
Infers left or right alignment from the source layout; Markdown center alignment is treated as left alignment. |
| Presentation | Draws complete Unicode or ASCII borders, styles header rows, supports horizontal rules and optional zebra striping. | Preserves the source table's shape, with an optional fancy vertical-bar style. |
| Large tables | Caches measurements and unchanged renderings and has no fixed source-size cutoff. | Defaults to a fixed-pitch fallback for tables larger than 4,000 characters. |
| Requirements | Emacs 29.1+, Org 9.6+ and TextUI 0.8.0+; currently installed from source or with package-vc. |
Emacs 26+ with no extra package dependency; available from GNU ELPA. |
Choose Valign when the main goal is to keep an Org or Markdown table aligned
while editing it, especially with variable-pitch text or inline images. Choose
org-table-widget when an Org buffer needs a reading-oriented table that wraps
to narrow windows and provides its own borders and row styling.
The packages should be treated as alternatives for the same Org table. Running both modes on one table is untested, and both manage display properties or overlays in that region.
0.3.1 is an early release. It is developed and used day to day on Emacs 32 (the development branch), so display behavior on earlier versions gets less testing. Reports from Emacs 29, 30 and 31 users are very welcome; please open an issue with your Emacs version.
Known limitations:
- Org width cookies are ignored.
- Very wide tables can overflow the window when minimum column widths do not fit.
Overflow is truncated when
truncate-linesis non-nil (the Org default), or wraps when nil; the widget does not changetruncate-lines. - Numeric columns are not automatically right-aligned; use an explicit
<r>cookie. - The sticky header slows scrolling through large tables, in both directions;
set
org-table-widget-sticky-headerto nil to avoid it. - Coexistence with
valignis untested; see above fororg-moderntest coverage.
See CHANGELOG.md for release changes.
Measured with demos/bench.el on macOS, Apple M4 Max,
Emacs 31.0.91 GUI, with Iosevka at height 150. Times are seconds.
| Table | First display | Refresh | Resize relayout | Leave table |
|---|---|---|---|---|
500 × 8 (large.org) |
0.355002 | 0.007237 | 0.279066 | 0.007163 |
3000 × 6 (generated huge.org) |
1.339867 | 0.034297 | 1.052924 | 0.034108 |
Refresh and leave-table timings reuse unchanged content; edits require rebuilding. These are single-run measurements on this machine, not guarantees for other setups.
Browse demos/ for example tables, benchmarks and visual checks.
With TextUI checked out alongside this repository, generate the benchmark inputs
(including the untracked huge.org), then run each GUI script in a separate Emacs:
emacs -Q --batch -l /absolute/path/to/org-table-widget/demos/gen-large.el -f org-table-widget-demo-generate
emacs -Q -l /absolute/path/to/org-table-widget/demos/bench.el
emacs -Q -l /absolute/path/to/org-table-widget/demos/visual-check.elReplace /absolute/path/to with your checkout's parent directory. Scripts write
ignored logs/profiles under demos/ and screenshots under demos/shots/, then exit.
With TextUI checked out alongside this repository, run the full ERT suite:
cd /path/to/org-table-widget
emacs -Q --batch -L . -L ../textui -L test -l org-table-widget.el \
-l test/org-table-widget-tests.el -l test/org-table-widget-demo-tests.el \
-f ert-run-tests-batch-and-exitThe redisplay-dependent motion tests are skipped in batch mode. In a graphical
Emacs, load test/org-table-widget-tests.el and run
M-x ert RET vertical-interactive RET.
For the optional org-modern compatibility test, put org-modern and its
dependencies on load-path, load test/org-table-widget-compat-tests.el, then
run M-x ert RET org-table-widget-compat- RET.
Prefer --batch when real pixels are unnecessary. On macOS, the Emacs.app
launcher ignores the shell working directory, hence the absolute paths above.
For GUI invocations, use absolute paths for every -l, file name in --eval,
and log path, or pass --chdir /absolute/path/to/org-table-widget before loading scripts.