New answers tagged

1

I think you just needed to add quotes around the values html and latex in the header elisp snippet as follows: #+begin_src emacs-lisp :exports both :results output (if (eq org-export-current-backend 'html) "html" "latex") (if (eq org-export-current-backend 'html) (princ "<ul><li>Green tea</li><li>Black tea&...


0

To add to JeanPierre's answer, you can run M-x customize-variable with org-babel-load-languages to modify the list from Emacs.


5

You can use the :eval no attribute on the block that you want to disable: #+begin_src shell echo "hi" #+end_src #+RESULTS: : hi #+begin_src python :eval no print("no print please") #+end_src


2

With python you probably have to use a :session to get persistence between src blocks. I like :results output personally, and use print statements where I want them. You can probably do this as follows: #+BEGIN_SRC python :session :results output def retX(x): return x #+END_SRC #+RESULTS: #+BEGIN_SRC python :session :results output print(retX(x=6)) #+...


3

The Noweb reference syntax may help in such cases. Using this syntax, the body of a given code block can be executed inside the body of another code block. As a summary of the Org manual page: You have to NAME the first code block Add its <<NAME>> in a second code block, which will have :noweb yes as a header argument. Then, <<NAME>> ...


Top 50 recent answers are included