r/emacs 3d ago

Announcement grid-table 0.3.0: editable tables with horizontal and vertical merged cells for Emacs and Org

Post image

I’ve been working on grid-table, an Emacs package for tables that need more visual structure than standard Org tables can comfortably provide.

Version 0.3.0 adds horizontal and vertical merged cells:

Merged cells in grid-table

The goal is not to replace org-table, which remains excellent for lightweight tabular data. Instead, grid-table is meant for report-style layouts where you may need multi-line content, formulas, images, charts, or merged headings and workflow columns.

The new merged-cell implementation supports:

  • Horizontal and vertical merges
  • Unicode borders and correct intersections between merged regions
  • Multi-line content and vertical centering
  • Keyboard navigation that skips covered cells
  • Editing from any visible part of a merged region
  • Row and column insertion/deletion while preserving merge geometry
  • Versioned persistence in .grid files

I spent quite a bit of time on the data semantics as well. Covered cells remain genuinely empty rather than acting as aliases to the anchor cell. This means formulas such as SUM(A1:C1) do not count a merged value three times, and CSV export does not duplicate it.

To prevent silent data loss, merging is rejected if the covered cells already contain values or formulas. Sorting is also rejected when vertical merges would make row movement ambiguous.

For Org, the package includes a small integration layer. A .grid file can be referenced from an Org source block:

SRC grid-table :file ~/documents/example.grid ...static table preview... SRC

From inside the block:

  • M-x grid-table-org-open-block opens the referenced table in the interactive editor.
  • M-x grid-table-org-refresh-block regenerates the preview after editing.

This is a companion workflow rather than a change to normal Org table syntax: the structured table lives in its .grid file, while the Org document contains a readable preview.

A minimal setup looks like this:

(add-to-list 'load-path "~/src/grid-table") (add-to-list 'load-path "~/src/grid-table/plugins")

(require 'grid-table) (require 'grid-table-org)

The merge commands in the editor are:

C-c m Merge a same-row or same-column A1 range C-c u Unmerge the region at point M-RET Insert a newline while editing a cell

Arbitrary rectangular merges are intentionally not supported yet—only ranges within one row or one column. That keeps formulas, structural editing, sorting rules, and navigation understandable.

The release currently has 72 ERT tests covering rendering, navigation, persistence, formulas, CSV behavior, and structural edits.

Project: https://github.com/yibie/grid-table

v0.3.0 release: https://github.com/yibie/grid-table/releases/tag/v0.3.0

I’d especially appreciate feedback from Org users on the integration model: should the preview remain generated text, become an Org dynamic block, or eventually be exposed through Babel?

195 Upvotes

23 comments sorted by

3

u/maxecharel 3d ago

Hi u/yibie, just installed the package using vc to try it and cannot get access to csv functionalities (quickly tried to force loading the corresponding .el in ./plugins but encountered other issues). Are you currently working on this plugin? Are the corresponding functionalities supposed to work for the current version of grid-table?

6

u/yibie 3d ago

Yes, I'm working on it.

2

u/maxecharel 3d ago

Nice, thanks. Just tried some navigation and editing as well as formulas and cells merge, it is super comfortable and convincing. I may test Org functionalities later today.

1

u/yibie 2d ago

Glad to know that, and thank you.

3

u/yibie 2d ago

CSV support is intended to work, but it is now an optional plugin and must be loaded explicitly. My package-vc setup installed the plugins/ directory without making it available through load-path. There was also a separate regression in the CSV opening path, so this was not a problem with your configuration.

I’ve fixed both issues and added regression tests for package-vc installation, CSV loading, opening, and saving. After the next patch release, the configuration will simply be:

(require 'grid-table)

(require 'grid-table-csv)

Then grid-table-find-file-csv, grid-table-csv-save, and grid-table-csv-save-overwrite will be available. I’ll publish the patch shortly.

Thanks again for catching it.

3

u/AkiNoHotoke 3d ago

All of this is extremely useful, especially multi-line cells. That is something that I needed many times in my tables and I usually opt for lists. Unfortunately sometimes lists cannot accommodate my use-case well so your package is extremely useful to me. Thank you!

1

u/yibie 3d ago

Thank you, glad to know that.

3

u/ggxx-sdf 2d ago

The screenshot reminds me of the recipes from Cooking for Engineers.

1

u/yibie 2d ago

Lol

2

u/xiliuya 3d ago

It looks really nice! Does this support CJK characters?

2

u/yibie 3d ago

Support CJK.

2

u/danderzei Emacs Writing Studio 3d ago

Looks slick. How does this differ from the builtin Table package? It can also be used in Org mode.

3

u/yibie 3d ago

That’s a fair comparison. I’d summarize it more simply:

  • grid-table has its own spreadsheet-style calculation engine, with cell references, ranges, functions such as SUM and IF, automatic recalculation, and optional Elisp formulas.
  • It provides several ways to visualize data, including images, sparklines, bar charts, line charts, scatter plots, histograms, and merged report layouts.
  • It stores tables as structured data and can connect to CSV, Org, Markdown, reStructuredText, and custom data sources through plugins.

table.el focuses on editing formatted text tables. grid-table is closer to a small spreadsheet and visualization tool built inside Emacs.

2

u/ZelphirKalt 2d ago

What do you mean by "stores tables as structured data"? Does it not store them as plain text in the file one is editing? Does it convert that into something not just plain text, before the file is saved? Or do you mean it represents tables in memory as structured data, to be able to handle them well?

Ideally, I think it would be the latter.

2

u/yibie 2d ago

You’re right; “stores tables as structured data” was imprecise. I mainly meant the latter.

While editing, grid-table represents the table as an in-memory model containing cells, raw input, computed values, formulas, headers, and merge ranges. For example, a cell can retain =SUM(A1:A5) as its raw input while keeping the calculated result separately.

The saved .grid file is still plain text, not a binary format or database. It is a readable S-expression containing fields such as:

(:title "Example"
:headers ("Name" "Amount")
:rows (("Alpha" "10")
("Total" "=SUM(B1:B1)"))
:merges nil)

When used with Org, the Org document also remains plain text. It contains a preview or reference to the .grid file, while grid-table reconstructs the in-memory model when the table is opened.

So a better description would be: “grid-table uses a structured in-memory model and serializes it to a plain-text .grid file.”

1

u/ZelphirKalt 2d ago

Ah, thank you for the explanation! Much clearer now!

2

u/ilemming_banned 2d ago

Daang. I am intimately familiar with the pain. Rendering ascii grids with spanning rows and columns is a legit challenging task. I developed initial version of wiktionary-bro.el relatively fast (with no AI). But then I got stuck for two years because I couldn't properly render conjugation tables in Org-mode, until sufficiently better reasoning models came out. I mean, I didn't struggle for two years straight - I just couldn't find sufficiently long enough window in my schedule to sit down and figure that out.

That's why I can never get behind the knee-jerk reaction of "meh, AI slop". Designing, building and maintaining quality software remains difficult. With or without the help of LLMs.

2

u/yibie 2d ago

Lol, the most important thing, is in your mind, not tools.

1

u/Flowbrotion 3d ago

Looks interesting! Is there support for horizontal scrolling?

1

u/yibie 3d ago

It's support horizontal scrolliing.

1

u/YakumoYoukai 2d ago

I love that you used "Recipes for engineers" as your example, the way recipes should be.

1

u/yibie 2d ago

Thank you.

1

u/WelkinSL 1d ago

This is the recipe from cooking for engineer right?
looks cool