The following all works:
; echo ;
-echo ;
; ; ; ; ;
;-;--;---;----;
echo "€ hello 🐩"
Thanks to @medranocalvo for suggesting the fix: use hex encoding to
send the lines.
This commit adds a deprecation warning when the org source block
header argument :terminal is set. This should give people time to
adjust their settings.
The settings `org-babel-tmux-terminal` org-babel-tmux-terminal-opts`
take precedence over the `:terminal` argument.
Since this is a backward-incompatible change, I have added a
changelog..
Tmux assumes a semicolon at the end of a command-line argument means
that a new command is started. See tmux man page around "Multiple
commands may ... a command sequence." This allows, for example, the
following two commands to be executed in one line:
tmux new-window; split-window -d
Unfortunately, this behaviour meant that trailing semicolons would not
be sent from ob-tmux. For instance,
echo hello;
would yield
> echo hello
In bash, a semi-colon is also interpreted as a command
separator. Hence, zapping the semicolon would usually not cause any
problems. It does, however, cause problems in multi-line strings,
heredocs, etc.
In short, the bug has now been fixed. I have checked that tmux does
not eat any other characters. The code that removes the semicolon is
in the function cmd_list_parse in the file cmd-list.c in the tmux
source code.
The `ob-tmux-' object holds the information for the current
session. This makes it easier to shuttle more information between
functions. For instance, implementing socket support is going to be a
lot easier now. Validating the session name is going to be easier too,
because there is a single point where it can fail.
All internal functions have been renamed to use the `ob-tmux--'
prefix. This makes the code easier to write and shorter.
The idea for the cl-defstruct came from:
https://nullprogram.com/blog/2018/02/14/
In Emacs 26, there should be even more support for this kind of
structure definition.
I want to use org-session as parameter when it expects the org-session
as typed in to an org document. The terms 'session', 'window', and
'target' should remain reserved for tmux sessions, windows, and
targets respectively.
Previously, if you had two sessions and wanted to target by index, a
new window would be created with the index as name. Nonetheless, the
command body would be sent to the window with the target index.
Test case:
echo hoi
echo hoi :session bug:=2 && date
Expected behaviour: date shows up on bug:b. no new window is created.
Actual behaviour: date shows up on bug:b. new window bug:"2" is
created.
Now the date shows up on bug:b and no new window is created.
When a command in the tmux source code block ended with a semi-colon,
it was previously ignored. Now we send the keys with the -l option to
send the line literally.
It is now possible to create multiple windows in the same
session. One can write, for example,
echo boom
echo done
This will open up a terminal window with one tmux session, named
'hello', and two windows, named 'boom' and 'done'.
Tests the tmux functionality. Also solves some problems in the
original implementation where the temp file would be read directly
after creation, i.e. before the random string could be written to the
file.