1

I asked a similar question a few years ago but I never did figure out how to proceed. I ended up aborting my excursion into org-babel. However, I can see how this would be really valuable, to intermix a basic org file with scripts and results. Unfortunately, it seems either groovy support in org-babel doesn't have all the bells or whistles or I just don't know the workarounds. I think it's an element of both.

I want to do something like this:

#+NAME: do_something
#+BEGIN_SRC groovy  :results output
  // do something groovy to generate results
#+END_SRC

#+NAME: process_something
#+BEGIN_SRC groovy :results output :vars mylist=do_something
  // now process all those groovy things
  mylist.each{ thing ->
      println thing
  }
#+END_SRC

However, it seems groovy doesn't have vars (see original question, above).

I also tried this:

#+NAME: process_something(mylist=do_something)
#+BEGIN_SRC groovy :results output
  mylist.each{ thing ->
      println thing
  }
#+END_SRC

Which also doesn't work. Additionally, ideally I would like to reuse a code block which again means somehow getting an argument into the code block.

So what it comes down to is:

  1. How can I process a result block with groovy?
  2. How can I pass an argument into a groovy block?
  • 1
    I think it is a good idea to ask org-mode developers for help. ob-groovy.el simply doesn't support :var right now. Someone needs to add the support. – xuchunyang Dec 8 '18 at 12:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.