Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default-directory' to body' in `org-babel-execute:tmux' #19

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

YorkZ
Copy link

@YorkZ YorkZ commented Dec 28, 2022

Hello,

I've made a change to ob-tmux.el that adds default-directory to the body of the org-babel-execute:tmux function. This allows the :dir header argument to take effect in tmux code blocks.

Please let me know if you have any questions or concerns about this change.

Thank you for maintaining this package.

Sincerely,

York

Change the current directory to `default-directory' before executing commands in
`org-babel-execute:tmux'. This allows the `:dir' header argument to take effect
in the tmux code block.
In the `ob-tmux--execute' and `ob-tmux--start-terminal-window' functions,
replace the non-blocking `start-process' function with the blocking
`call-process' function to ensure that the operation is completed before
returning. This also allows the function to handle errors by checking the return
value of `call-process'.

- Use `call-process' instead of `start-process'
- Check return value of `call-process' and handle error
In the `org-babel-execute:tmux' function, if the current session is a default
session, kill it before creating a new one. This ensures that a new session is
always created, even if a default session already exists.

This is necessary for safety concerns, as reusing the default session may result
in unexpected behavior due to leftover variables from previous sessions.

- Check if current session is default session
- Kill default session before creating new one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant