ob-async icon indicating copy to clipboard operation
ob-async copied to clipboard

I want shell code blocks executed via emacs org babel to be verbose, stoppable, interactable, asynchronous

Open oystersauce8 opened this issue 5 years ago • 21 comments

I wanted to create this issue/feature request in the org mode repository, but the org mode repository is not hosted on github. So I'm using this github.com/astahlman/ob-async repo for this issue.

This issue/task is about extending the emacs text editor (or one of its plugins such as this ob-async) - to make it more user friendly. There's no single right solution. I'm not even sure if this is the right repository to tackle this.

I want shell code blocks executed via emacs org babel to be a) verbose - output should be shown live b) stoppable c) interactable d) asynchronous (https://github.com/linktohack/ob-async does this)

The ideal solution should be language agnostic, so that python/ruby/whatever code blocks can have the same facilities.

Background: Please familiarize yourself with Emacs https://en.wikipedia.org/wiki/Emacs org-mode https://en.wikipedia.org/wiki/Org-mode https://code.orgmode.org/bzg/org-mode babel https://orgmode.org/worg/org-contrib/babel/ https://www.youtube.com/watch?v=dljNabciEGg https://emacs.stackexchange.com/search?q=ob-async If you get stuck, ask on emacs.stackexchange.com

Details:

Press Control-C Control-C to execute this code block

#+BEGIN_SRC sh :results output raw echo 'hello world' #+END_SRC

You should get the result

#+RESULTS: hello world

Now execute this block

#+BEGIN_SRC sh :results output raw sleep 60 #+END_SRC

Now emacs is unresponsive for 60 seconds. What's needed: Provide the ability for user to kill the process by pressing a keyboard shortcut. Use Control-c Control-k if thats available.

Execute this block #+BEGIN_SRC sh :results output raw
for i in $(seq 10); do echo "This is echo number: $i"; sleep 1;done
#+END_SRC
You should get this result

#+RESULTS: This is echo number: 1 This is echo number: 2 This is echo number: 3 This is echo number: 4 This is echo number: 5 This is echo number: 6 This is echo number: 7 This is echo number: 8 This is echo number: 9 This is echo number: 10

What's needed: We want to show the output line by line "live". Try the code block on a vanilla terminal and you will see the echo happening every second for ten seconds. Don't forget STDERR. Both STDOUT and STDERR output should be made visible to the user.

I want to suggest a window-split to display the output. For an example of something like this, try using the "rubocop-check-project" provided by this package: https://github.com/rubocop-hq/rubocop-emacs

Try this block

#+BEGIN_SRC sh :results output echo -n "Enter your name and press [ENTER]: " read name echo "you said $name" #+END_SRC

In a case like this, in the minibuffer or a split-winodow, emacs should wait for me the user to provide the input.

Try this block

#+BEGIN_SRC ruby :results output puts "Enter your name and press [ENTER]: " $name = gets puts "you said $name" #+END_SRC

In a case like this, in the minibuffer or a split-winodow, emacs should wait for me the user to provide the input.

It would be nice to be able to interact with REPLs.

#+BEGIN_SRC ruby :results output require 'byebug' #assumes you did gem install byebug puts "hello world" byebug # a breakpoint in ruby > 2.0 puts "passed the breakpoint" #+END_SRC

When executing the above code, users should be able to interact with the REPL that appears when the "byebug" line is hit. Users would exit the repl by typing c for continue. (This c shortcut is a byebug builtin)

If possible please test your solution on EMACS (HEAD version) MacOS (latest version) with Emacs Prelude (latest version).

Any questions, don't hesitate to ask.

oystersauce8 avatar Oct 09 '18 22:10 oystersauce8

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 0.52 ETH (118.81 USD @ $228.49/ETH) attached to it as part of the Unnamed Organization fund__.__

gitcoinbot avatar Oct 09 '18 22:10 gitcoinbot

Hi @oystersauce8, I'd never heard of Gitcoin, but I love the idea! Thanks for funding development on open source.

I want shell code blocks executed via emacs org babel to be a) verbose - output should be shown live b) stoppable c) interactable d) asynchronous (https://github.com/linktohack/ob-async does this)

This package already takes care of d). The other requirements all have some prior discussion in these existing issues:

  • a) verbose - https://github.com/astahlman/ob-async/issues/13
  • b) stoppable - https://github.com/astahlman/ob-async/issues/29
  • c) interactable - https://github.com/astahlman/ob-async/issues/33

astahlman avatar Oct 10 '18 14:10 astahlman

In addition to the discussions @astahlman mentioned there's also this question/answer

https://emacs.stackexchange.com/questions/45252/i-want-shell-code-blocks-executed-via-emacs-org-babel-to-be-verbose-stoppable

oystersauce8 avatar Oct 10 '18 15:10 oystersauce8

https://github.com/ali2210/emacs--ob-go

ali2210 avatar Dec 04 '18 17:12 ali2210

@ali2210 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot avatar Dec 09 '18 17:12 gitcoinbot

i had solve only golang part , issue still open anyone for developers anyone can work on multiple languages

ali2210 avatar Dec 09 '18 18:12 ali2210

@ali2210 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • [x] reminder (3 days)
  • [ ] escalation to mods (6 days)

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot avatar Dec 15 '18 17:12 gitcoinbot

Will you elaborate me about WIP PR? Issues i had resolved 1. go run emacs 2. ob-async 3. split-window Issues I had not resolve c,ruby and shell running along with go. That's why still open issue

On Sat, Dec 15, 2018 at 10:15 PM Gitcoin.co Bot [email protected] wrote:

@ali2210 https://github.com/ali2210 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • reminder (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day https://gitcoin.co/issue/astahlman/ob-async/42/1413?snooze=1 | 3 days https://gitcoin.co/issue/astahlman/ob-async/42/1413?snooze=3 | 5 days https://gitcoin.co/issue/astahlman/ob-async/42/1413?snooze=5 | 10 days https://gitcoin.co/issue/astahlman/ob-async/42/1413?snooze=10 | 100 days https://gitcoin.co/issue/astahlman/ob-async/42/1413?snooze=100

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/astahlman/ob-async/issues/42#issuecomment-447583417, or mute the thread https://github.com/notifications/unsubscribe-auth/ATnYDxU-9GFDCtwITekYJae0OYxlyBv5ks5u5S5FgaJpZM4XUOU4 .

ali2210 avatar Dec 16 '18 04:12 ali2210

within an hour i will submit my work . Transaction under process.

On Sun, Dec 16, 2018 at 9:37 AM Ali Hassan [email protected] wrote:

Will you elaborate me about WIP PR? Issues i had resolved

  1. go run emacs
  2. ob-async
  3. split-window Issues I had not resolve c,ruby and shell running along with go. That's why still open issue

On Sat, Dec 15, 2018 at 10:15 PM Gitcoin.co Bot [email protected] wrote:

@ali2210 https://github.com/ali2210 Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

  • reminder (3 days)
  • escalation to mods (6 days)

Funders only: Snooze warnings for 1 day https://gitcoin.co/issue/astahlman/ob-async/42/1413?snooze=1 | 3 days https://gitcoin.co/issue/astahlman/ob-async/42/1413?snooze=3 | 5 days https://gitcoin.co/issue/astahlman/ob-async/42/1413?snooze=5 | 10 days https://gitcoin.co/issue/astahlman/ob-async/42/1413?snooze=10 | 100 days https://gitcoin.co/issue/astahlman/ob-async/42/1413?snooze=100

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <https://github.com/astahlman/ob-async/issues/42#issuecomment-447583417 , or mute the thread < https://github.com/notifications/unsubscribe-auth/ATnYDxU-9GFDCtwITekYJae0OYxlyBv5ks5u5S5FgaJpZM4XUOU4

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/astahlman/ob-async/issues/42#issuecomment-447617335, or mute the thread https://github.com/notifications/unsubscribe-auth/ATnYD5BfhJ4QQRnoHJt3aqX6-RZteo1kks5u5c4YgaJpZM4XUOU4 .

ali2210 avatar Dec 16 '18 06:12 ali2210

Will you elaborate me about WIP PR?

@ali2210 I'm not sure I understand what you are asking for, or the current state of your work with respect to this issue. I looked over https://github.com/ali2210/emacs--ob-go and I don't see how it relates to extending ob-async to make code-block execution verbose, stoppable, interactable, or asynchronous.

Can you give a summary of your work and explain how it will address this issue?

astahlman avatar Dec 17 '18 01:12 astahlman

if possible please demo the work using a screenrecorder / animated gif maker such as LiceCap (https://licecap.en.softonic.com/)

oystersauce8 avatar Dec 17 '18 02:12 oystersauce8

I must say i was a bit surprised at the mention of golang - because i though babel was mostly for scripted / interpreted languages (bash, perl, python, ruby, etc) . and go is predominantly a compiled language.

oystersauce8 avatar Dec 17 '18 02:12 oystersauce8

okay Sir i will send you project demo

On Mon, Dec 17, 2018 at 7:26 AM Sam Weerasinghe [email protected] wrote:

I must say i was a bit surprised at the mention of golang - because i though babel was mostly for scripted / interpreted languages (bash, perl, python, ruby, etc) . and go is predominantly a compiled language.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/astahlman/ob-async/issues/42#issuecomment-447703857, or mute the thread https://github.com/notifications/unsubscribe-auth/ATnYD23bIW3JM_4Qfab7l7Nx7O4Lr2vOks5u5wDegaJpZM4XUOU4 .

ali2210 avatar Dec 17 '18 03:12 ali2210

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


Work for 0.52 ETH (66.66 USD @ $128.19/ETH) has been submitted by:

  1. @ali2210

@oystersauce8 please take a look at the submitted work:

  • PR by @ali2210

gitcoinbot avatar Dec 23 '18 21:12 gitcoinbot

After checked out the emacs---ob-go repo, have not found any code about async execution. Neither gif (the gif in repo does not play) can show the async as expected work.

stardiviner avatar Dec 26 '18 02:12 stardiviner

                                                                                  If you read init.el you can found ob-async package install and org-babel run with that package                                                                                                                                                                                                                                                                                                                                        Sent from my BlackBerry 10 smartphone.                                                                                                                                                                                                                From: KinSent: Wednesday, 26 December 2018 07:42To: astahlman/ob-asyncReply To: astahlman/ob-asyncCc: Ali Hassan; MentionSubject: Re: [astahlman/ob-async] I want shell code blocks executed via emacs org babel to be verbose, stoppable, interactable, asynchronous (#42)After checked out the emacs---ob-go repo, have not found any code about async execution. Neither gif (the gif in repo does not play) can show the async as expected work.

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/astahlman/ob-async","title":"astahlman/ob-async","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/astahlman/ob-async"}},"updates":{"snippets":[{"icon":"PERSON","message":"@stardiviner in #42: After checked out the emacs---ob-go repo, have not found any code about async execution. Neither gif (the gif in repo does not play) can show the async as expected work."}],"action":{"name":"View Issue","url":"https://github.com/astahlman/ob-async/issues/42#issuecomment-449891653"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/astahlman/ob-async/issues/42#issuecomment-449891653", "url": "https://github.com/astahlman/ob-async/issues/42#issuecomment-449891653", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

ali2210 avatar Dec 26 '18 03:12 ali2210

@ali2210 Your API key is explosed. Please delete secret in post. And indeed used ob-async, but have not make it controllable like the issue mentioned.

stardiviner avatar Dec 26 '18 08:12 stardiviner

                                                                                  Okay sir                                                                                                                                                                                                                                                                                                                                        Sent from my BlackBerry 10 smartphone.                                                                                                                                                                                                                From: KinSent: Wednesday, 26 December 2018 13:35To: astahlman/ob-asyncReply To: astahlman/ob-asyncCc: Ali Hassan; MentionSubject: Re: [astahlman/ob-async] I want shell code blocks executed via emacs org babel to be verbose, stoppable, interactable, asynchronous (#42)@ali2210 Your API key is explosed. Please delete secret in post.

And indeed used ob-async, but have not make it controllable like the issue mentioned.

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/astahlman/ob-async","title":"astahlman/ob-async","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/astahlman/ob-async"}},"updates":{"snippets":[{"icon":"PERSON","message":"@stardiviner in #42: @ali2210 Your API key is explosed. Please delete secret in post.\r\nAnd indeed used ob-async, but have not make it controllable like the issue mentioned."}],"action":{"name":"View Issue","url":"https://github.com/astahlman/ob-async/issues/42#issuecomment-449929797"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/astahlman/ob-async/issues/42#issuecomment-449929797", "url": "https://github.com/astahlman/ob-async/issues/42#issuecomment-449929797", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

ali2210 avatar Dec 26 '18 09:12 ali2210

                                                                                  You asked me api key exposed ? What's controlled ?                                                                                                                                                                                                                                                                                                                                        Sent from my BlackBerry 10 smartphone.                                                                                                                                                                                                                From: KinSent: Wednesday, 26 December 2018 13:35To: astahlman/ob-asyncReply To: astahlman/ob-asyncCc: Ali Hassan; MentionSubject: Re: [astahlman/ob-async] I want shell code blocks executed via emacs org babel to be verbose, stoppable, interactable, asynchronous (#42)@ali2210 Your API key is explosed. Please delete secret in post.

And indeed used ob-async, but have not make it controllable like the issue mentioned.

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread. {"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/astahlman/ob-async","title":"astahlman/ob-async","subtitle":"GitHub repository","main_image_url":"https://github.githubassets.com/images/email/message_cards/header.png","avatar_image_url":"https://github.githubassets.com/images/email/message_cards/avatar.png","action":{"name":"Open in GitHub","url":"https://github.com/astahlman/ob-async"}},"updates":{"snippets":[{"icon":"PERSON","message":"@stardiviner in #42: @ali2210 Your API key is explosed. Please delete secret in post.\r\nAnd indeed used ob-async, but have not make it controllable like the issue mentioned."}],"action":{"name":"View Issue","url":"https://github.com/astahlman/ob-async/issues/42#issuecomment-449929797"}}} [ { "@context": "http://schema.org", "@type": "EmailMessage", "potentialAction": { "@type": "ViewAction", "target": "https://github.com/astahlman/ob-async/issues/42#issuecomment-449929797", "url": "https://github.com/astahlman/ob-async/issues/42#issuecomment-449929797", "name": "View Issue" }, "description": "View this Issue on GitHub", "publisher": { "@type": "Organization", "name": "GitHub", "url": "https://github.com" } } ]

ali2210 avatar Dec 26 '18 09:12 ali2210

See this related post for some work in this direction: https://github.com/astahlman/ob-async/issues/1#issuecomment-498033946

jackkamm avatar Jun 02 '19 14:06 jackkamm

Awesome This Message send through secure channel called BBM

On Sun, Jun 2, 2019 at 7:03 PM jackkamm [email protected] wrote:

See this related post for some work in this direction: #1 (comment) https://github.com/astahlman/ob-async/issues/1#issuecomment-498033946

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/astahlman/ob-async/issues/42?email_source=notifications&email_token=AE45QD5SYLZYJ4F7EOKAX2LPYPHKJA5CNFSM4F2Q4U4KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWXWLLA#issuecomment-498034092, or mute the thread https://github.com/notifications/unsubscribe-auth/AE45QDY7VBQCC55KTB3RETTPYPHKJANCNFSM4F2Q4U4A .

ali2210 avatar Jun 02 '19 16:06 ali2210