[[!meta title="Making Org-Babel Reactive"]] [[!meta copyright="Copyright © 2025 Abhinav Tushar"]] [[!inline pages="internal(2025/info/org-babel-nav)" raw="yes"]] # Making Org-Babel Reactive Abhinav Tushar (he/him) - , [@lepisma@mathstodon.xyz](https://mathstodon.xyz/@lepisma), [[!inline pages="internal(2025/info/org-babel-before)" raw="yes"]] In Org mode, you can add and execute small snippets of code using Org-Babel. This lets you have an extremely useful mixed-language notebook like environment inside Emacs. These days, many notebook systems provide fully reactive notebooks where changes made in any cell or variable propagate to its dependents without manual execution. This pattern is very useful for exploratory data analysis, visualization, and many other use-cases that notebooks are generally good for. Unsurprisingly, we can enable such reactivity in Org-Babel without too much effort. In this talk, I will cover how to do that while also adding certain other interaction niceties to make full use of the resultant reactivity. About the speaker: I am a programmer and machine learning engineer, and I have enjoyed working with Org-Babel code blocks inside my writings. Other notebooks and platforms have recently started to adopt fully reactive computation, which is something I have liked a lot for exploratory analysis. In this talk, I will show how to add similar reactivity in Org-Babel. ## Discussion / notes - Q: Is there a web page describing this topic? - A: The repository readme is here [https://dev.lepisma.xyz/git/ob-rx/](https://dev.lepisma.xyz/git/ob-rx/){rel="noreferrer noopener"} but not sure if you meant any other kind of description. - Q: If I understand correctly, recomputation happens upon saving; why not tie it to C-c C-c instead? - A: You can tie the (interactive) function it to C-c C-c too, I usually prefer on-save reactivity when I need reactivity. - Q: You mentioned that you are working on something similar for JS\... what do you have now? (Thanks! =)) - A: I don't have something public but I am using a webkit child frame to show up d3 plots. Will add this in ob-rx once I have it stable. - Q: If this could work on C-c C-c and as a minor mode, then it could perhaps be contributed upstream!  Is that planned? - A: Not thought about it, maybe. - Q:Is it possible to do something reactive with :result file :file my-generated.file (?) - yes you got it, it's just I make intermediate compilation steps in org sometimes using that. - A: Yes, the core mechanism is to just control the order of execution for code blocks. So any normal workflow involving files will also work. I have tried a few file workflows and ended up needing ob-async so that Emacs doesn't get stuck. But I am not sure if I understood your exact use case (?). - Q:how does it handle circular dependencies? - A: I haven't checked if my approach gets stuck in circular dependencies (it should), but usually when I am writing org-babel notebooks, I end up not having circular dependencies. The check for this should be easy enough though and the minor-mode could warn if it detects a circular dep. Will add this in later versions. - Q: How to get the block dependence plot? Very nice. - It's a small piece of graphviz code in the minor mode, here [https://git.sr.ht/\~lepisma/ob-rx/tree/master/item/ob-rx.el#L118](https://git.sr.ht/~lepisma/ob-rx/tree/master/item/ob-rx.el#L118){rel="noreferrer noopener"} - Thank you. - Q: I'm curious what packages you're using for org appeance. It looks like a mix of org-modern and some other packages. (Yes I am also interested in your overall emacs theme) - A: So my config is here [https://git.sr.ht/\~lepisma/rogue/tree](https://git.sr.ht/~lepisma/rogue/tree){rel="noreferrer noopener"} but maybe the core part of the look is based on my older blog - I'm really looking forward to this talk. - Excited to see reactivity in org-babel! - Your emacs theme is very pleasing!! - I will try this type of dependence block. It looks like it can save a lots of mental effort to organize my data. - Excellent talk! - [https://dev.lepisma.xyz/git/ob-rx](https://dev.lepisma.xyz/git/ob-rx){rel="noreferrer noopener"} \<- source code - Cool project! - Great talk and beautiful Emacs! - This seems to add useful features to org-babel, great job! - Very cool! - Very interesting ! - https://dev.lepisma.xyz/git/ob-rx/ - this looks useful. - I'm quite fond of Pluto.jl in Julia, so it'd be nice to have something like this that I can use from inside Emacs. - Yeah, it also reminded me of Pluto - But I really prefer working from inside Emacs, so I don't use Pluto that much. This is great - It could hopefully minimize my usage of rstudio - I was thinking something like that too for the R folk - Indeed, rstudio is nice, but it is not emacs - excellent talk by tushar [[!inline pages="internal(2025/info/org-babel-after)" raw="yes"]] [[!inline pages="internal(2025/info/org-babel-nav)" raw="yes"]]