Commit Graph

48 Commits (master)

Author SHA1 Message Date
Allard Hendriksen cb4f151554 Update documentation and changelog 2022-10-05 22:41:18 +02:00
Allard Hendriksen e672ca5a95
Merge pull request #17 from KaiHa/pr14
Support variables (fixes #14)
2022-10-05 22:25:16 +02:00
Kai Harries 155ffea48e Support variables (fixes #14)
Forward the variables that are set in the org-babel-header.

E.g

  #+begin_src tmux :var name="Ismael"
    echo hello ${name}
  #+end_src
2022-09-28 22:18:57 +02:00
Allard Hendriksen 3687ed7b87 Fix bug with ob-tmux-format-keys
It was misspelled..
2019-07-08 14:02:40 +02:00
Allard Hendriksen 4d222155a2 Fix bug with where lines with leading "-" were omitted
The following all works:

; echo ;
-echo  ;

; ;  ;   ;    ;
;-;--;---;----;

echo "€ hello 🐩"

Thanks to @medranocalvo for suggesting the fix: use hex encoding to
send the lines.
2019-07-05 17:57:02 +02:00
Allard Hendriksen 9bf6b35b8a Add deprecation warning for :terminal header arguments
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..
2019-07-05 17:55:29 +02:00
dkrm 00e0de3cd7 Update README: add explanation to terminal settings 2019-01-02 17:23:12 +01:00
dkrm 9cd0c05338 Add the possibility to choose the terminal 2018-12-21 12:47:45 +01:00
dkrm 9a3361f13f Remove unnecessary concat function 2018-12-21 11:49:10 +01:00
dkrm 867d1802b2 Fix issue #7 (allowing options to the terminal) 2018-12-21 11:39:17 +01:00
Allard Hendriksen 73bed0ebad Fix bug where trailing semicolon at end of line would be omitted
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.
2018-08-31 12:17:45 +02:00
Allard Hendriksen 4b5c30eea9 Remove redundant TODO comments
Socket is set in `ob-tmux--execute'.
2018-08-30 16:52:38 +02:00
Allard Hendriksen 2ad983419f Update README: installation instructions for MELPA 2018-08-30 16:52:19 +02:00
Allard Hendriksen 92f398cf0e Fix license language
Previously, the license paragraphs referred to 'GNU Emacs' instead of
'this program'.
2018-08-06 16:31:46 +02:00
Allard Hendriksen 8886f31291 Bump version 0.1.5 2018-07-19 17:51:18 +02:00
Allard Hendriksen 16c59c9b18 Change defvar -> defcustom
Inspired by ob-elvish commit:
9552e44996
2018-07-19 17:49:49 +02:00
Allard Hendriksen eab05445f2 Move internal functions
To get rid of compiler warnings.
2018-07-17 10:59:26 +02:00
Allard Hendriksen fb4333a59e Rename internal functions
To get rid of compiler warnings.
2018-07-17 10:55:47 +02:00
Allard Hendriksen b712cddbdc Remove string-empty-p
I do not want to add a dependency for such a simple function.
2018-07-17 10:43:56 +02:00
Allard Hendriksen 9ecdc7d3a5 Implement checkdoc advice 2018-07-17 10:37:01 +02:00
Allard Hendriksen aae8f4e082 Implement flycheck-package advice
Partially. I still have to improve some documentation.
2018-07-17 09:58:25 +02:00
Allard Hendriksen f3e695dbea Update README: add iterm configuration
Adds iterm configuration.
2018-07-17 09:14:04 +02:00
Allard Hendriksen ed9c7ba5e3 Update package metadata 2018-07-17 09:11:39 +02:00
Allard Hendriksen 2bc16cd9e3 Update documentation 2018-07-16 17:44:44 +02:00
Allard Hendriksen 8e1d328285 Add socket support 2018-07-16 17:11:55 +02:00
Allard Hendriksen 8b445540c7 Rewrite to use single structure to hold session
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.
2018-07-16 16:13:17 +02:00
Allard Hendriksen 79cea3e7ac Use the org-babel-tmux-start-terminal-window function
It was not used previously..

This adds support for starting an xterm terminal
2018-07-16 13:53:33 +02:00
Allard Hendriksen 0c8b054838 Centralize shell-command-to-string executions of tmux 2018-07-16 13:49:36 +02:00
Allard Hendriksen 40dfabed82 Centralize tmux execution points
Now, org-babel-tmux-location is correctly used everywhere.
2018-07-16 13:13:49 +02:00
Allard Hendriksen ba76074ffa Add option to set a default window name
If net set by the user, the first window will not be named "1" by
default anymore.
2018-07-16 12:16:25 +02:00
Allard Hendriksen 0b09770835 Fix parameter name: consistency
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.
2018-07-16 12:16:25 +02:00
Allard Hendriksen 9b9c578c95 Fix inconsistency bug in create-window and send-keys
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.
2018-07-16 12:16:03 +02:00
Allard Hendriksen 26f738b8f9 Start in home directory without extra slashes 2018-07-16 10:42:06 +02:00
Allard Hendriksen 5ccf47725e Disable window renaming from within tmux
Session renaming would frustrate sessions where you would SSH into
some machine and then no be able to use ob-tmux anymore to control the
session.
2018-07-16 10:41:00 +02:00
Allard Hendriksen c8ee803a5f Send strings literally
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.
2018-04-19 10:49:41 +02:00
Allard Hendriksen 43f815da1c Fix bug in org-babel-prep-session:tmux
It did not set process-name correctly.
2018-04-19 10:49:21 +02:00
Allard Hendriksen 4cc0c89501 Add shell-mode syntax highlighting
Also C-c ' now opens a side buffer to edit the code block in
shell-mode.
2018-03-19 09:02:06 +01:00
Allard Hendriksen 510b5f4fee Improve README.org
- Spelling improvements
- Add syntax highlighting to configuration
- Improve wording where needed.
2018-01-11 23:39:44 +01:00
Allard Hendriksen c6d716a53c Change README to org format
Move from markdown to org mode. Seems more appropriate. I hope github
supports all the syntax.
2018-01-11 23:14:24 +01:00
Allard Hendriksen f75eb08f0c Remove :cmd support
It was not used and tmux has sensible defaults. I think it defaults to
bash now.
2018-01-11 22:20:40 +01:00
Allard Hendriksen d4752b9ec1 Add xterm support 2018-01-11 22:19:44 +01:00
Allard Hendriksen 1443272963 Clean up code
Separate session creation from starting the terminal window.
2018-01-11 21:46:52 +01:00
Allard Hendriksen beacdb5ffc Add support for tmux windows
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'.
2018-01-09 09:56:18 +01:00
Allard Hendriksen d5deb53751 Implement org-babel-tmux-test
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.
2018-01-05 15:01:27 +01:00
Allard Hendriksen f7fd2b2301 Improve shell string escaping
Previously, some characters would be escaped by the shell before being
sent to tmux. Now, I believe this has been solved.
2018-01-05 14:24:43 +01:00
Allard Hendriksen 862d1d21b7 Update copyright statement 2018-01-03 21:06:41 +01:00
Allard Hendriksen 32717a5001 Add README 2018-01-02 19:06:43 +01:00
Allard Hendriksen 0619483254 Initial commit 2018-01-02 18:58:25 +01:00