When I launched #Orgro, my mobile #Emacs #orgmode app, in 2020, one of the first feature requests I got was support for editing.

I'm happy to announce, three years later, that experimental editing support is ready for beta testing:
https://github.com/amake/orgro/issues/6#issuecomment-1713920175

Support editing · Issue #6 · amake/orgro

Currently, it seems the app only allows for viewing of org files. Are there any plans to provide write functionality in the app? If so, perhaps we should figure out a roadmap of desirable editing f...

GitHub

The major hurdles I had to jump over were:

1. Retaining enough information, especially white space, from the original document to reproduce it from the AST verbatim

Discussion:
https://github.com/petitparser/dart-petitparser/discussions/142

There didn't seem to be any silver bullets for this, so I just slogged through explicitly capturing white space tokens in org_parser.

Parsing while preserving all whitespace (in an ergonomic fashion) · petitparser/dart-petitparser · Discussion #142

First, thanks very much to @renggli for this wonderful library, but also for helping out the community with the discussions here. I have a PetitParser-based parser that I use in a viewer applicatio...

GitHub

2. Deciding on the AST editing model

I designed the AST to be immutable, and I didn't want to give that up, so it was a challenge figuring out how to enable editing.

I had heard of zippers (https://en.wikipedia.org/wiki/Zipper_(data_structure)) but never used them. After some struggle I managed to wrap my head around them, and found that they fit well with the #Flutter reactive state paradigm.

Zipper (data structure) - Wikipedia

3. A challenge I've only started looking at: UI

It doesn't seem feasible to offer a pure text-editing UI like Emacs. I'm not sure such a UI would be ergonomic on a mobile device anyway.

So what will I make editable and through what kinds of UI controls? So far I have:

- Tap a list iteme checkbox to toggle it

- Long press a section headline to pop up a menu from which you can cycle the TODO state

Additional editing features will probably depend on a lot on the use case.