New answers tagged

1

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


0

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 (let (... ... ... (shell-langs org-babel-shell-names)...


0

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. #+name: config.yaml #+begin_src sh :exports results :results output echo """ name: john why: check # below is a dict example # see it allows ...


1

The Error 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 ...


0

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)


1

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


0

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: '(org-babel-load-languages '((python . t) (emacs-lisp . t)))...


0

Much easier than the AA: Using the built-in function (org-sbe ...: * Example using (org-sbe): #+NAME: snippet1 #+BEGIN_SRC emacs-lisp :var txt="snippet1 was called" (message txt) #+END_SRC 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 ...


2

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


1

You can make a simple bibtex execute function like this: #+BEGIN_SRC emacs-lisp (defun org-babel-execute:bibtex (body params) body) #+END_SRC Then use a variable instead of noweb like this: #+BEGIN_SRC python :results output :var bibdata=sample_bib import bibtexparser from bibtexparser.bwriter import BibTexWriter from bibtexparser.bibdatabase import ...


1

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. Examples In both cases, 1+2 is not enough. #+begin_src js :results value return 1 + 2; #+end_src #+RESULTS: : 3 #+begin_src js :results output console.log(1 + ...


3

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 #+end_src


Top 50 recent answers are included