Org-babel support for tmux via emamux.
- Send commands to external tmux sessions through org-babel source blocks.
- Integrated with TRAMP.
- Doesn’t require forwarding sockets.
Add ob-emamux.el to your load-path, then load it and add emamux
to org-babel-load-languages
:
(require 'ob-emamux)
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
(shell . t)
(python . t)
(emamux . t)))
An ob-emamux
source block looks like this:
#+begin_src emamux :session 0:0.0
echo hello world
#+end_src
The :session
parameter is specified as session:window.pane
.
If not set to a specific value, it will use the default emamux target,
or prompt for one if it isn’t set.
While this does not directly affect ob-emamux
, some
emamux
functions (e.g. emamux:yank-from-list-buffers
)
require the following configuration to work with tmux
versions 2.0+.
(setq emamux:show-buffers-with-index nil)
(setq emamux:get-buffers-regexp
"^\\(buffer[0-9]+\\): +\\([0-9]+\\) +\\(bytes\\): +[\"]\\(.*\\)[\"]")
See ob-tmux for an alternative. Summary of the main differences:
ob-tmux
- Launches an external terminal (e.g.
xterm
) with a new tmux session. - Manages its own sessions, and prefixes their tmux session names
with
org-babel-
. - Interacting with existing sessions requires a socket file to connect. Remote sessions also require forwarding an SSH tunnel.
- Launches an external terminal (e.g.
ob-emamux
- Aimed at interacting with existing tmux sessions.
- Handles remote sessions through TRAMP.