10 ms·
Emacs packages, and Org specifically, tend to have a hands-on approach to editing files: Emacs' API relies on moving around the cursor (‘point’) and doing stuff
by aasasd 4y ago
Emacs packages, and Org specifically, tend to have a hands-on approach to editing files: Emacs' API relies on moving around the cursor (‘point’) and doing stuff in its vicinity, and Org has rather little abstraction on top, basically jumping from user-visible commands straight to this fiddling.
My dream is that Org is implemented in layers instead: a low-level Org API deals with the text and provides concepts of headings, lists and such, the internal ‘business logic’ uses those, and the interface and user commands are built on top. Then extensions to Org, like my personal functions and customizations, can also operate on the higher-level concepts, instead of having to mess with text regularly or to keep in mind how each function moves the cursor.
Another dream is that Elisp is implemented as a standalone embeddable engine, instead of being conjoined with Emacs. Thus, if the two dreams merge, third-party applications could embed elisp, have their own low-level Org API that uses the app's structures, with their own interface plugged into that—but borrow logic from Org and bolt other scripts and customizations onto it. Like, I could just copy my scripts from the desktop onto the phone. That's my kind of PIM.
Of course, there would be limitations, like working with snippets in other languages, which unavoidably relies on Emacs' text APIs. But personally I can sacrifice that on the phone, just as I do now with Orgzly.
- profsnuggles 4y agoWell I think the first is kind of what orgdown is trying to do. https://karl-voit.at/2021/11/27/orgdown/ https://karl-voit.at/2021/11/27/orgdown/ As for the second doesn't guile have a feature complete elisp implementation?
- aasasd 4y agoAfaik Guile is now persistently in the state of ‘kinda done’—it got bogged down in lexical scope or something like that, and no progress is seen for a quite a while. Remacs seemed to be the next hopeful, but apparently is also abandoned for the past two years: https://github.com/remacs/remacs https://github.com/remacs/remacs
- funcDropShadow 4y agoElisp as an embedable engine would be cool, but it would still need lots of the other parts of Emacs, e.g. the buffer data structure. A more realistic approach would be to implement some kind of FFI/RPC display type in emacs and compile the whole of emacs as a library or with emacsen.
- aasasd 4y ago> it would still need lots of the other parts of Emacs, e.g. the buffer data structure As I wrote right there, the embedding app could have its own implementation of low-level Org parts, talking to the app's internal structure and storage. Running the whole of Emacs on a phone, and with tons of crosstalk to emulate the display, and with logic in the app to process that emulated display and convert into the actual interface, would be bonkers, which is why no one does that. Completely wrong level of abstraction—it's just the same problem of too much low-level fiddling, amplified into an entire inter-app API.
- BeetleB 4y agoThe lack of good node/graph based APIs for Org Mode is my beef as well. When you compare it with the APIs of the Leo Editor[1], Org pales in comparison. Manipulation that is trivial in the Leo Editor can be quite a pain in Org mode. [1] https://leoeditor.com/ https://leoeditor.com/
- kqr 4y agoWhat is "node/graph" based APIs that's not the next-heading etc functions that it does have?
- BeetleB 4y agoLet me see if I can remember some of them: Say I have a node. I want all the children in some form (tree, list, whatever). Say I want to move a node and all its children from one location to another. Given a node, I want its text, but not its children. Given a node with a subtree, I want to manipulate the document so that it becomes flat. All its (nested) children are elevated to the level just under the node. I want to compare if two nodes are "equal" (same text, and recurse downwards). Given a node with a subtree, I want to traverse in some order of my choosing (DFS, BFS, etc). I want a count of how many child nodes there are (1st level) I want a count of how many children there are (all levels). The API may have some of these, but likely not all of them. All of these are trivial in Leo, as Leo gives this to you as a tree. Most of Org's API involve some level of parsing, manipulating the cursor, etc.
- aasasd 4y agoI ended up writing a few functions that implement that kind of an API on top of what Org provides—just a handful of them so far, ones that I needed for the last customizations. I'm probably not the first to do that, and vaguely remember seeing something like that on Github.
- User23 4y agoI think it would be interesting to build an orgmacs distro, probably building on Nicolas Rougier’s excellent work. Basically, present it as a standalone note taking tool with “modern” keybindings and appearance and have Emacs just be an implementation detail. “Powered by Emacs” would be in the branding somewhere to give credit, but not front and center where it’ll scare people off. The main reason I haven’t done it myself is because I've used Emacs for over two decades and I don’t mind it’s idiosyncrasies anymore than I mind that lisp has parentheses.
- fsiefken 4y agospacemacs within for example aquamacs would go a long way already.