On Sun, Jul 27, 2025 at 12:12 PM Ihor Radchenko <yanta...@posteo.net> wrote: > > "John Wiegley" <jo...@gnu.org> writes: > > > 1. Use =org-table-to-lisp= to parse the Org table into a Lisp matrix (list > > of > > lists). > > > > 2. Map through all of the cells in this matrix, converting each into a > > closure > > that maps from a matrix of strings to a string. > > > > The work of each such closure is to calculate the formula for that > > particular cell using =org-table-eval-formula= — which may involve > > looking > > up the relevant cell, row or column formula from the table’s formula > > field > > — and resolving any cell references by looking up those values in the > > matrix argument. > > ... > > That would be nice indeed! > > > When I went looking at org-table.el, I find that it’s very much tailored to > > work on the state of the buffer and its “work space”, and may not be so easy > > to convert to a functional style, where instead we convert the table to a > > Lisp > > data structure, operate on the data structure, and then render it back out > > to > > a table. > > Unfortunately, yes. org-table.el is a very old code. > > > Are there any org-table.el masters who might be interested in helping with > > such a reworking of the calculation engine? > > I am afraid that even I am lost in that file. > But I do have some familiarity with that code and I will be willing to > help if someone leads the refactoring effort. > Also, CCing Corwin who has been working on some improvements/extensions > to org-table.el recently. >
Thanks Igor, and John! I do indeed have some work in this area! What I have been building is an RX based method of parsing TBLFM that will, I hope, make it easier to maintain and provide the basis for adding more features to TBLFM parsing in the future. I'm particularly interested in interpolating variables within TBLFM formula before/while evaluating them. Speaking of unparsable, here is a program that represents a fairly working example of the direction I'm heading in: https://cgit.git.savannah.gnu.org/cgit/dungeon.git/tree/src/ox-ox-test.el#n34 If we evaluate the linked file and then M-x my:do-rx-test RET it creates a buffer where with the generated (via rx) regular expression as well several "test cases" including the named capture groups filled while applying the generated regular expression to each, all wrapped in the form an org-mode document.