News for hackers. Stuff that matters.
Re:Run programs in Emacs buffer, seeing their output inline,... by kaiwen1 on Monday September 26, 2022 @12:55AM (#32979571)
This is useful! Are there other packages on MELPA that provide similar functionality?
Re:Run programs in Emacs buffer, seeing their output inline,... by merlincorey on Monday September 26, 2022 @01:05AM (#32979630)
`org-mode` has the ability to evaluate code blocks and store the output in a following results block[0].

You can configure it to run just about everything in various ways and therefore you can do Literate Programming in nearly the full Knuth sense in it.

I find it's a good solution for a local "notebook" similar to IPython/Jupyter Notebooks but for any language in Emacs.

[0] https://orgmode.org/manual/Evaluating-Code-Blocks.html

Re:Run programs in Emacs buffer, seeing their output inline,... by xenodium on Monday September 26, 2022 @03:20AM (#32980362)
Extending org babel to support other languages is fairly accessible. I had a lot of fun getting SwiftUI to rendering inline https://xenodium.com/previewing-swiftui-layouts-in-emacs-rev...

Also did a little experiment for Objective-C https://xenodium.com/org-babel-objective-c-support

Re:Run programs in Emacs buffer, seeing their output inline,... by ghosty141 on Monday September 26, 2022 @05:10AM (#32980957)
The first link is really impressive. Amazing what can be achieved with so little code/configuration.
Re:Run programs in Emacs buffer, seeing their output inline,... by aesyondu on Monday September 26, 2022 @02:14AM (#32980006)
Org+babel is probably my favorite thing about emacs, magit being a close second.

I tried doing Literate Programming using this blog as my guide http://fgiasson.com/blog/index.php/2016/06/21/optimal-emacs-..., but I got burned out pretty quickly. I think my problem was I put literally everything in a single README.org file, and it was so taxing scrolling up and down. I might try again but with multiple org files.

Re:Run programs in Emacs buffer, seeing their output inline,... by findingaway on Monday September 26, 2022 @01:05AM (#32979626)
Org mode provides a supercharged version of this functionality that will work for any language as long as you can point it to an appropriate runtime. It's definitely a little more verbose, since you have to declare the language and stuff inside the org mode syntax, but I'm sure that you could get it to work ad-hoc with a little hacking.

https://orgmode.org/worg/org-contrib/babel/

Re:Run programs in Emacs buffer, seeing their output inline,... by robertkrahn01 on Monday September 26, 2022 @01:48AM (#32979834)
There is lively.el [1]! It is also on MELPA in a more recent version [2]. It allows to put an elisp expression into any buffer and then replaces that with the output in a time interval or manually. I use that frequently.

[1] https://lukego.livejournal.com/23379.html [2] https://github.com/purcell/lively/tree/348675828c6a81bfa1ac3...

Re:Run programs in Emacs buffer, seeing their output inline,... by hajovonta on Monday September 26, 2022 @09:32AM (#32982906)
Wow this package rocks!
Re:Run programs in Emacs buffer, seeing their output inline,... by unhammer on Monday September 26, 2022 @05:34AM (#32981074)
https://blog.sulami.xyz/posts/literate-calc-mode/ is pretty nice. I always have literate-calc-minor-mode (+org-mode as major) in my scratch buffer for quick calculations.
Re:Run programs in Emacs buffer, seeing their output inline,... by edrx on Monday September 26, 2022 @09:04PM (#32990571)