The best way to generate an Rmd file from an org file is to use ox-ravel.
I use it all the time to generate the Rmd and then the html file using rmarkdown::render. It is great to share results with non-emacs users. It handles inline images, code, inline tables, you can add interactive images with plotly, interactive networks with networkviz etc.
The one ...
Just to add complementary information, there is an org-babel-shell-names variable defined in ob-shell.el that you can use instead of defining your own list
(defun org-export-insert-shell-prompt (_backend)
(org-babel-map-src-blocks nil ; nil implies current buffer
Not an exact solution, but I was able to get around with shell src block printing the yaml text which then was consumed by the python src block as a variable.
Here are the contents of my org file now.
#+begin_src sh :exports results :results output
# below is a dict example
# see it allows ...
octave> > > error: fprintf: wrong type argument 'class'
error: called from
dlmwrite at line 195 column 7
This is because you assigned a value of type sym to the variable ans. fprintf(), which is a part of wrapping code while Org Babel is evaluating it, is trying to write the given ans but because the value of ans isn't class char and ...
A small variation of eric's answer that works for me:
(defun org-syntax-table-modify ()
"Modify `org-mode-syntax-table' for the current org buffer."
(modify-syntax-entry ?< "." org-mode-syntax-table)
(modify-syntax-entry ?> "." org-mode-syntax-table))
(add-hook 'org-mode-hook #'org-syntax-table-modify)
I was led to my preferred answer to that question by a comment (Thank you! @Mutbuerger ) :
You may use (cadr (org-babel-lob--src-info NAME)) from ob-lob instead.
This brought me to:
(org-babel-expand-noweb-references (org-babel-lob--src-info NAME))
The other solution with (org-element-at-point) didn't feel "idiomatic" for cases, where you are not ...
It looks like yaml as a language is not supported in source code blocks.
At least it is not listed in the Languages Section of the org-manual.
The error message usually means that the language is not loaded by org-babel and you have to load it in your emacs config file (.emacs or init.el) like so:
'((python . t)
(emacs-lisp . t)))...
Much easier than the AA: Using the built-in function (org-sbe ...:
* Example using (org-sbe):
#+BEGIN_SRC emacs-lisp :var txt="snippet1 was called"
If you want to run the above SCB, you could just place
the curson on the closing bracket ")" of “(org-sbe "snippet1")”,
and just run ...
For the Lisp nesting problem, make sure that your cfg-make-device-header block is NOT under the influence of those properties, otherwise when the block is evaluated to e.g. calculate the prologue of the other block, the headers apply to it as well, so you recurse infinitely.
And there is a quoting problem because... I don't know, I couldn't figure it out. It'...
You can make a simple bibtex execute function like this:
(defun org-babel-execute:bibtex (body params)
Then use a variable instead of noweb like this:
#+BEGIN_SRC python :results output :var bibdata=sample_bib
from bibtexparser.bwriter import BibTexWriter
from bibtexparser.bibdatabase import ...
For future passengers, :results value (the default option) requires an explicit return statement to display its value. On the other hand, :results output displays everything from the standard output.
In both cases, 1+2 is not enough.
#+begin_src js :results value
return 1 + 2;
#+begin_src js :results output
console.log(1 + ...
You can close the file descriptors for stdin, stdout and stderr using a :prologue header arg. Of course, if the script opens other file descriptors, you will have to close those too, but in the simplest case, the three standard ones will be enough:
#+begin_src shell :prologue exec 0>&- 1>&- 2>&-
sleep 10 & disown