ASK HN: Some thoughts on a possible AST-aware org-mode three way merge driver
I've noticed that many people do use git for syncing their notes and treat manual conflict handling simply as part of life. For some reasons I just can't bring myself to like it, but I also really would like to have full syncing capabilities on Org mode.
I've seen that in 2012 some folks implemented a dedicated merge driver (org-merge-driver[1]) which only covers the basics but is aware of org syntax and operated on a per-headline basis, merging tags if needed and identifying changes from the name/id of the headline.
I've been wondering if something like this could be re-implemented using org-mode's own parser (org-element). I've been reading a paper that describes a three way merge for XML documents (and generic hierarchical documents) without IDs being involved[2] and another paper that describes a way to merge ordered sequences that takes movements (even crossing ones), deletions and insertions into account[3]. Nothing bleeding edge and I wonder if something like this may stand on its own feet from a functional and performance perspective.
Do you think something like this may be a good idea? Do you have some advice to give on this regard? Sorry for the quite abstract and quite fluff-y post, but this idea has been hanging in my head for too long.
[0] https://github.com/simonthum/git-sync
[1] https://orgmode.org/worg/org-contrib/gsoc2012/student-projects/git-merge-tool/manual.html
[2] A three-way merge for XML documents :: https://dl.acm.org/doi/10.1145/1030397.1030399
[3] A graph-based algorithm for three-way merging of ordered collections in EMF models :: https://www.sciencedirect.com/science/article/pii/S0167642315000532
5 comments
[ 0.21 ms ] story [ 13.5 ms ] thread[0] zed : http://news.ycombinator.com/item?id=39119835
I once tried using synching and that resulted in almost immediate conflicts. This is not my area of expertise, but if I had to guess it's because dropbox is master-slave, where's synching is peer to peer.
The mobile story for org-mode is still not great.
Conflicts are unavoidable if two hosts write in an interleaved manner and with unreliable internet connection. For example
Shopping List
- Eggs
- Bread
- Molk <---- Host 1 edits this into "Milk"
- Sugar
- Coffee <---- Host 2 adds this line
If these 2 changes occur at the same time, how would Dropbox merge them, having no knowledge of the semantics of the org document? There is a conflict and Dropbox may solve it in a "last writer wins" manner or by performing a merge by line like in git.