Improve README.org
- Spelling improvements - Add syntax highlighting to configuration - Improve wording where needed.hello-test
parent
c6d716a53c
commit
510b5f4fee
44
README.org
44
README.org
|
@ -1,6 +1,12 @@
|
||||||
* ob-tmux
|
* ob-tmux
|
||||||
Ob-tmux is an Emacs library that allows org mode to evaluate code
|
Ob-tmux is an Emacs library that allows org mode to evaluate code
|
||||||
blocks in a tmux session.
|
blocks in a tmux session.
|
||||||
|
|
||||||
|
Ob-tmux is useful for keeping notes on how to perform tasks in the
|
||||||
|
terminal, especially when some interactivity is required. The
|
||||||
|
functionality can be used to document software installation, build
|
||||||
|
instructions, and administrative tasks. The documentation can be
|
||||||
|
tested and adjusted while it is written.
|
||||||
* Installation
|
* Installation
|
||||||
Unfortunately, ob-tmux has not yet been added to melpa. You will need
|
Unfortunately, ob-tmux has not yet been added to melpa. You will need
|
||||||
to copy the ~ob-tmux.el~ file to a directory in your ~load-path~.
|
to copy the ~ob-tmux.el~ file to a directory in your ~load-path~.
|
||||||
|
@ -18,17 +24,22 @@ In your ~.emacs~ or ~.emacs.d/init.el~ file, add the following:
|
||||||
;; You can customize this if you like.
|
;; You can customize this if you like.
|
||||||
(setq org-babel-tmux-session-prefix "org-babel-session-")
|
(setq org-babel-tmux-session-prefix "org-babel-session-")
|
||||||
|
|
||||||
;; Finally, if you tmux is not in your $PATH for whatever reason, you
|
;; Syntax highlighting can be added with the following line:
|
||||||
|
(add-to-list 'org-src-lang-modes (cons "tmux" 'sh))
|
||||||
|
|
||||||
|
;; Finally, if your tmux is not in your $PATH for whatever reason, you
|
||||||
;; may set the path to the tmux binary as follows:
|
;; may set the path to the tmux binary as follows:
|
||||||
(setq org-babel-tmux-location "/usr/bin/tmux")
|
(setq org-babel-tmux-location "/usr/bin/tmux")
|
||||||
|
|
||||||
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
* Usage
|
* Usage
|
||||||
You can start a new terminal window with a tmux session as follows:
|
You can start a new terminal window with a tmux session as follows:
|
||||||
: #+BEGIN_SRC tmux :session hello
|
: #+BEGIN_SRC tmux :session hello
|
||||||
: echo hello
|
: echo hello
|
||||||
: #+END_SRC
|
: #+END_SRC
|
||||||
If you press =C-c C-c= with your point in the code block, a new
|
If you press =C-c C-c= with your point in the code block, a terminal
|
||||||
terminal window will pop up with a new tmux session named
|
window will pop up with a new tmux session named
|
||||||
=org-babel-session-hello=.
|
=org-babel-session-hello=.
|
||||||
|
|
||||||
You can continue work in this session with another code block.
|
You can continue work in this session with another code block.
|
||||||
|
@ -38,8 +49,11 @@ You can continue work in this session with another code block.
|
||||||
If you press =C-c C-c= now, no new terminal window will open, but the
|
If you press =C-c C-c= now, no new terminal window will open, but the
|
||||||
code will be sent to the existing tmux session.
|
code will be sent to the existing tmux session.
|
||||||
|
|
||||||
You can open new windows within the existing session using the
|
You can also specify to which tmux window the source block should be
|
||||||
familiar tmux syntax.
|
sent. If the tmux window does not yet exist, ob-tmux will create it.
|
||||||
|
To specify the window, you may use the tmux target syntax. In the
|
||||||
|
following example, the ~:session~ argument has been changed to
|
||||||
|
=hello:new-world=:
|
||||||
: #+BEGIN_SRC tmux :session hello:new-window
|
: #+BEGIN_SRC tmux :session hello:new-window
|
||||||
: echo hello world in new-window
|
: echo hello world in new-window
|
||||||
: #+END_SRC
|
: #+END_SRC
|
||||||
|
@ -48,15 +62,12 @@ session.
|
||||||
|
|
||||||
You can exit your tmux session by detaching. The terminal window will
|
You can exit your tmux session by detaching. The terminal window will
|
||||||
close automatically. Ob-tmux will not detect that you have
|
close automatically. Ob-tmux will not detect that you have
|
||||||
detached. Any commands you send will be sent in the background. You
|
detached. Any commands you send will be sent to the tmux session in
|
||||||
can reattach to your tmux session at any time and check that the
|
the background. You can reattach to your tmux session at any time and
|
||||||
commands have indeed been executed.
|
check that the commands have indeed been executed.
|
||||||
|
|
||||||
Ob-tmux is useful for keeping notes on how to install software
|
|
||||||
or perform tasks in the terminal, especially when some interactivity
|
|
||||||
is required. It is also very useful for starting up your tmux
|
|
||||||
sessions after a reboot. Take a Look at the following snippet.
|
|
||||||
|
|
||||||
|
*Tip*. Ob-tmux is also very useful for restarting your tmux sessions
|
||||||
|
after a reboot. Take a Look at the following snippet.
|
||||||
: ** Startup tmux
|
: ** Startup tmux
|
||||||
: Use ~C-c C-v s~ to execute subtree.
|
: Use ~C-c C-v s~ to execute subtree.
|
||||||
: *** Jupyter
|
: *** Jupyter
|
||||||
|
@ -72,17 +83,16 @@ sessions after a reboot. Take a Look at the following snippet.
|
||||||
: #+BEGIN_SRC tmux :session daemons:dmesg
|
: #+BEGIN_SRC tmux :session daemons:dmesg
|
||||||
: dmesg
|
: dmesg
|
||||||
: #+END_SRC
|
: #+END_SRC
|
||||||
|
|
||||||
If your point is on the =Startup tmux= header, you can execute all
|
If your point is on the =Startup tmux= header, you can execute all
|
||||||
code blocks in the subtree with ~C-c C-v s~ to jump start your tmux
|
code blocks in the subtree with ~C-c C-v s~ to restart your favorite
|
||||||
sessions.
|
tmux sessions.
|
||||||
|
|
||||||
* Known bugs and or possible issues
|
* Known bugs and or possible issues
|
||||||
My tmux indexes start at 1. By default, tmux window indexes start at
|
My tmux indexes start at 1. By default, tmux window indexes start at
|
||||||
zero. This might lead to problems. I have not yet checked.
|
zero. This might lead to problems. I have not yet checked.
|
||||||
|
|
||||||
Terminals other than xterm and gnome-terminal have not been
|
Terminals other than xterm and gnome-terminal have not been
|
||||||
checked. If you have positive or negative experiences with any other
|
tested. If you have positive or negative experiences with any other
|
||||||
terminal, let me know.
|
terminal, let me know.
|
||||||
|
|
||||||
I will try to respond within a week to any issues raised. I cannot
|
I will try to respond within a week to any issues raised. I cannot
|
||||||
|
|
Loading…
Reference in New Issue