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

Feature: Ability to cancel to async requests #29

Open
dangirsh opened this issue May 16, 2018 · 1 comment
Open

Feature: Ability to cancel to async requests #29

dangirsh opened this issue May 16, 2018 · 1 comment

Comments

@dangirsh
Copy link

Maybe there's already a way to do this, but I'm not sure how:

I'd like to be able to cancel the async request for a given block.

I'm unsure how feasible this is, but thought I'd start the discussion.

Thanks for an excellent package!

@astahlman
Copy link
Owner

This seems doable.

We use async-start [1] to run the org-babel execute function asynchronously [2]. async-start returns the underlying process object, to which we can send a SIGKILL by calling delete-process [3]. We would need to do some bookkeeping to map process objects to src_blocks, since there can be multiple asynchronous processes active simultaneously.

I'm not sure of the best way to present this to the user - maybe the user would have to invoke the cancel function with point on the corresponding src_block? We'd also need to decide whether to clean up the RESULTS block, or to just leave it as-is.

I'd gladly accept a PR if anyone wants to take a shot at it, but let's make sure we agree on the UI aspect, first.

[1] https://github.com/jwiegley/emacs-async/blob/04e1a2c40bef305450389da540ffe7594964e430/async.el#L341
[2]

(async-start

[3] https://www.gnu.org/software/emacs/manual/html_node/elisp/Deleting-Processes.html#Deleting-Processes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants