reddit / emacs

extending folding in org/babel

antoinedestexupery · 2022-01-25 13:15
​ I have org files with lots of sections of all sorts (markdown, plain text, code, calculations, directory trees, etc., etc.), some of them within babel #+begin and #+end delimiters, some not. All these sections have some implicit foldable structure. Some have exisiting appropriate language modes, some do not. My question is, in coding up custom folding commands for these sections, should I try and base the commands on extending the folding functions provided by org-mode, or should I choose my preferred folding library (of which there are many) and extend it, potentially clashing with org-mode in some way? I think I like stateful/persistent folding as in "vimish-fold". I prefer staying within the org-mode buffer rather escaping to a dedicated buffer and returning. Any pointers to discussions much appreciated.
spinochet · 2022-01-25 14:57
Org mode uses narrowing. My attempts to use it within an org file, but in separate functions, have been frustrating and fruitless. Extending org mode's functions seems the way to go to avoid repeating my mistakes.