Re: Adding #+name to result block in babel
Henrik Frisk writes: [snipped] Then you can use the result like this: #+begin_src sh :var value=my_result echo $value #+end_src #+RESULTS: : hello This does not use the result but rather reevaluates the "my_result" code block. Thank you! That was good to be reminded of, but I should have been more explicit in my first email. I'm working with a language (sclang) that for various reasons does not have support for variables in this way. The only option I have to include the results from one block is by using a noweb referens: #+begin_src shell echo "Hello" #+end_src #+RESULTS: #+name: my_result : Hello #+begin_src sclang :noweb yes <> #+end_src You could try adapting the examples for using :post at the end of: https://orgmode.org/manual/Results-of-Evaluation.html But in my (limited) experience it is difficult to get the output right. Another suggestion is to use a templating system for generating the src block and include the #+name: part in the template. I use yasnippet for this. -- Johan Tolö
Re: Adding #+name to result block in babel
Den tis 29 nov. 2022 kl 06:20 skrev Bill Burdick : > Hi Henrik, > > On Tue, Nov 29, 2022 at 2:11 AM Henrik Frisk wrote: > >> Hi, >> >> Maybe I'm missing something obvious but is it possible to have a name be >> added to the result block such as running: >> >> #+begin_src shell >> echo "Hello" >> #+end_src >> >> results in >> >> #+RESULTS: >> #+name: my_result >> : Hello >> >> Thank you! >> > > Name your block, like this: > #+name: my_result > #+begin_src sh > echo hello > #+end_src > > When you evaluate it, you'll get this: > > #+name: my_result > #+begin_src sh > echo hello > #+end_src > > #+RESULTS: my_result > : hello > > Then you can use the result like this: > > #+begin_src sh :var value=my_result > echo $value > #+end_src > > #+RESULTS: > : hello > Thank you! That was good to be reminded of, but I should have been more explicit in my first email. I'm working with a language (sclang) that for various reasons does not have support for variables in this way. The only option I have to include the results from one block is by using a noweb referens: #+begin_src shell echo "Hello" #+end_src #+RESULTS: #+name: my_result : Hello #+begin_src sclang :noweb yes <> #+end_src
Re: Adding #+name to result block in babel
Hi Henrik, On Tue, Nov 29, 2022 at 2:11 AM Henrik Frisk wrote: > Hi, > > Maybe I'm missing something obvious but is it possible to have a name be > added to the result block such as running: > > #+begin_src shell > echo "Hello" > #+end_src > > results in > > #+RESULTS: > #+name: my_result > : Hello > > Thank you! > Name your block, like this: #+name: my_result #+begin_src sh echo hello #+end_src When you evaluate it, you'll get this: #+name: my_result #+begin_src sh echo hello #+end_src #+RESULTS: my_result : hello Then you can use the result like this: #+begin_src sh :var value=my_result echo $value #+end_src #+RESULTS: : hello -- Bill
Adding #+name to result block in babel
Hi, Maybe I'm missing something obvious but is it possible to have a name be added to the result block such as running: #+begin_src shell echo "Hello" #+end_src results in #+RESULTS: #+name: my_result : Hello Thank you!