Re:Let's write a treesitter major mode for Emacs
by morelisp on Thursday September 14, 2023 @10:11AM
(#37509339)
https://orgmode.org/worg/dev/org-element-api.html
But even with this I found it pretty awful.
Re:Let's write a treesitter major mode for Emacs
by ics on Thursday September 14, 2023 @11:11AM
(#37510074)
What was awful about it? It's been a while since setting up but my config uses it to pluck the important bits from my Org library into SQLite as I edit; it works well enough and wasn't difficult to set up or understand. Admittedly it is relegated to this one step so that everything else can query docs with SQL but I was quite happy that the API exists so as not to do the parsing myself with the mistakes and minor deviations that would entail.
Re:Let's write a treesitter major mode for Emacs
by imaltont on Thursday September 14, 2023 @11:01AM
(#37509944)
While it doesn't properly understand the structure, you can move around pretty well with Imenu or (configured) org-goto. I assume it's also possible to make something for it so that it take nesting into consideration like it does for some programming languages. My org files are only a couple 1000 lines though, so don't know how they perform when it gets larger than that.
Re:Let's write a treesitter major mode for Emacs
by elviejo on Thursday September 14, 2023 @11:19AM
(#37510184)
Organice is org-mode but as react apt.
they have pretty complete parser.
https://github.com/200ok-ch/organice#background-information
Re:Let's write a treesitter major mode for Emacs
by Brentward on Thursday September 14, 2023 @02:39PM
(#37512965)
In org-alert we use `org-map-entries` and a simple `org-alert--parse-entry` function for stripping out the details we're looking for. Depending on what you want, it's not exactly a data structure, but maybe it will help you get started!
https://github.com/spegoraro/org-alert/blob/master/org-alert...
Part of this is surely that I don't know wtf I'm doing, but it seemed like there was not an underlying data structure held in memory that you could conveniently query / manipulate, but rather, most of the existing org functionality built some kind of structure each time you did an operation.
Would appreciate any pointers, code examples, tutorials that show how to effectively navigate / manipulate an org structure and have it reflected in the buffer, if there is such a thing.