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

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

Open
oystersauce8 opened this issue Oct 9, 2018 · 21 comments

Comments

@oystersauce8
Copy link

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.

@gitcoinbot
Copy link

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__.__

@astahlman
Copy link
Owner

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:

@oystersauce8
Copy link
Author

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

@ali2210
Copy link

ali2210 commented Dec 4, 2018

@gitcoinbot
Copy link

@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 | 3 days | 5 days | 10 days | 100 days

@ali2210
Copy link

ali2210 commented Dec 9, 2018

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

@gitcoinbot
Copy link

@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 | 3 days | 5 days | 10 days | 100 days

@ali2210
Copy link

ali2210 commented Dec 16, 2018 via email

@ali2210
Copy link

ali2210 commented Dec 16, 2018 via email

@astahlman
Copy link
Owner

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?

@oystersauce8
Copy link
Author

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

@oystersauce8
Copy link
Author

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.

@ali2210
Copy link

ali2210 commented Dec 17, 2018 via email

@gitcoinbot
Copy link

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:


@stardiviner
Copy link
Contributor

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.

@ali2210
Copy link

ali2210 commented Dec 26, 2018 via email

@stardiviner
Copy link
Contributor

@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.

@ali2210
Copy link

ali2210 commented Dec 26, 2018 via email

@ali2210
Copy link

ali2210 commented Dec 26, 2018 via email

@jackkamm
Copy link

jackkamm commented Jun 2, 2019

See this related post for some work in this direction: #1 (comment)

@ali2210
Copy link

ali2210 commented Jun 2, 2019 via email

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

6 participants