Skip to content

ii/ob-tmux-extensions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ob-tmux-extensions

ob-tmux is :results silent. These extensions fix that.

Issue #6 has been open for six years: you C-c C-c a tmux block, the command runs, but nothing comes back to your org file. This repo adds output capture, asciinema recording, and live streaming to ob-tmux blocks.

Posts

Each .org file is both an executable demo and a publishable post (via ox-ghost).

  • ob-tmux-capture — Getting results back. Marker-based capture, pane snapshots, output filtering, and an agent-pair demo showing two Claudes talking via tmux.
  • ob-tmux-asciinema — Streaming and recording. Live terminal sessions, cast files, #+BEGIN_ASCIINEMA embeds. (coming soon)
  • ob-tmux-live — Live literate programming. Stream-to-post workflow. (coming soon)

Packages

PackageFilePurpose
ob-tmux-captureob-tmux-capture.elCapture tmux pane output (markers, pane snapshot)
ob-tmux-asciinemaob-tmux-asciinema.elAsciinema recording, streaming, metadata

The .el files are standalone packages. The .org files demonstrate and document them — they don’t tangle/generate the elisp.

Installation

Doom Emacs

Add to ~/.config/doom/packages.el:

(package! ob-tmux)
(package! ob-tmux-capture
  :recipe (:host github :repo "ii/ob-tmux-extensions"
           :files ("ob-tmux-capture.el")))
(package! ob-tmux-asciinema
  :recipe (:host github :repo "ii/ob-tmux-extensions"
           :files ("ob-tmux-asciinema.el")))

Add to ~/.config/doom/config.el:

(use-package! ob-tmux-capture
  :after ob-tmux
  :config
  (ob-tmux-capture-enable-advice))

(use-package! ob-tmux-asciinema
  :after ob-tmux-capture
  :config
  (setq ob-tmux-asciinema-server-url "https://asciinema.mcclimans.net"))

Then: ~/.config/emacs/bin/doom sync

straight.el / use-package

(use-package ob-tmux-capture
  :straight (:host github :repo "ii/ob-tmux-extensions"
             :files ("ob-tmux-capture.el"))
  :after ob-tmux
  :config
  (ob-tmux-capture-enable-advice))

(use-package ob-tmux-asciinema
  :straight (:host github :repo "ii/ob-tmux-extensions"
             :files ("ob-tmux-asciinema.el"))
  :after ob-tmux-capture)

Manual

(add-to-list 'load-path "~/src/ob-tmux-extensions")
(require 'ob-tmux-capture)
(require 'ob-tmux-asciinema)
(ob-tmux-capture-enable-advice)

Quick Start

1. Create a tmux session

tmux has-session -t demo 2>/dev/null || tmux new-session -d -s demo -n main

2. Capture with markers (execute + capture)

#+begin_src tmux :session demo:main :capture markers
kubectl get pods
#+end_src

3. Pane snapshot (grab what’s on screen)

#+begin_src tmux :session demo:main :capture pane
#+end_src

4. Record with asciinema

#+begin_src tmux :session demo:main :capture asciinema :log yes
echo "Recording this!"
#+end_src

Header Arguments

ArgumentValuesDefaultDescription
:capturepane, markers, asciinemamarkersCapture method
:timeoutseconds30Max wait time
:linesN or -NnoneFirst/last N lines of output
:grepregexnoneFilter output lines
:rawyes / nonoKeep prompts and echoes
:scrollbacklinesvisiblePane history depth
:logyes / nonoCAST_LOG drawer (asciinema)
:stream-tostream-idnoneRemote streaming (asciinema)
:keep-castyes / nonoRetain local cast file
:idle-limitseconds2Max idle in recording

Troubleshooting

Capture not working after install

Check that advice is enabled:

(princ (if (advice-member-p 'ob-tmux-capture-advice-execute 'org-babel-execute:tmux)
           "Advice enabled"
         "Advice NOT enabled - run (ob-tmux-capture-enable-advice)"))

Package not found after doom sync

~/.config/emacs/bin/doom doctor

Rebuild: M-x straight-rebuild-package RET ob-tmux-capture

Credits

Built by ii.coop, solving ahendriksen/ob-tmux#6.

Based on ob-tmux by Allard Hendriksen.

About

Output capture and asciinema recording for org-babel tmux blocks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors