What's the deal with Deno? We talk with a major contributor to find out. Listen now.

Hot answers tagged

12

According to https://lists.gnu.org/archive/html/emacs-orgmode/2015-11/msg00425.html ob-sh was renamed ob-shell in org 8.2 ... and I cite from there: org-babel-get-header was removed in 0d000f5 (babel: small change in API., 2015-10-29), but the old ob-sh.el is still trying to call it. That means you should replace (sh . t) by (shell . t) in your call of ...


4

There are multiple issues going on, which I will do my best to address in a language agnostic manner. Short Generic Answer Use org-babel-expand-src-block1 to preview code that will be executed in the temporary file. Place cursor, i.e. the point, inside the code block on on the #+BEGIN_SRC line. Press C-c C-v v to open new Org-Babel Preview buffer. Debug ...


4

You can find out how your code is executed by checking ob-shell.el. As for your particular example, your code is passed to bash as stdin, something like the following $ echo 'echo $VAR_DEFINED_IN_BASHRC' | bash It will not work, you need the following instead $ echo 'echo $VAR_DEFINED_IN_BASHRC' | bash -i So you need to run bash interactively (-i) to ...


3

#+begin_src clojure :results pp (+ 1 4) #+end_src #+RESULTS: : 5 #+begin_src clojure :results output (print "Hello World!") #+end_src #+RESULTS: : Hello World! So we have to specify the output.


3

The function org-babel-expand-noweb-referenes will expand the <<noweb>> entries. You can call this function from another source block (use a :wrap header argument to make source the output is wrapped in an appropriate source block): #+NAME: expand-noweb #+BEGIN_SRC elisp :exports none (save-excursion (org-babel-goto-named-src-block name) ...


2

You have #+end_src emacs-lisp. This confuses org-babel. Use just #+end_src. Use the easy template system to insert structural elements and avoid such issues. Source blocks are <s <TAB>.


2

Try the full path to python3 inside the double quotes "foo/bar/baz/python3"


2

Only if you use the header argument :results value the code of the block is wrapped by a function and the result of the code block is the return value of that function. #+BEGIN_SRC python :exports both :results value return 7 + 7 #+END_SRC On the other hand :results output means that the code of the block is sent to the interpreter. The result of the code ...


2

Use org-sbe in :dir header to fetch the result from a named block. Tip: Create dirB directory in same directory as the org-mode example file otherwise the pwd command will throw an error. #+NAME: block-a #+BEGIN_SRC elisp (format "%sdirB" (file-name-directory (buffer-file-name))) #+END_SRC #+RESULTS: block-a : /tmp/sx/org-mode/dirB #+NAME: block-b #+...


2

Looks like it might be possible to achieve it by creating a helper lisp function: #+name: block-1 #+BEGIN_SRC sh echo '/bin' #+END_SRC #+RESULTS: block-1 : /bin #+begin_src emacs-lisp :results silent (defun result1 () (save-excursion (org-babel-goto-named-result "block-1") (setq value (org-babel-read-result)) ) (print value) ...


1

You can "deactivate" a block with the :eval no header argument. You could also try to cache the results, using the :cache yes, which would not re-execute the block unless its contents has changed. References: https://orgmode.org/manual/Evaluating-Code-Blocks.html#Evaluating-Code-Blocks https://orgmode.org/manual/Using-Header-Arguments.html#Using-Header-...


1

The rule is that if you want to specify header arguments for source blocks, then you need to use the various headers-args* properties: only those are consulted when a source block is executed. You can define other properties like PRJ-DIR and tangle, as you did above. But unless you do something special with them, they will not affect the evaluation of a ...


1

You can use org-babel-execute:org from that answer. Just put it in your init file. I think a (require 'cl-lib) in front of it should make the code run in your init file. Therewith executing an org source block will duplicate it with the header variables replaced by their values. See the following example: Before Execution: #+NAME: block-1 #+BEGIN_SRC ...


1

There are two options you could use, but I imagine that none are exactly what you want: 1) Create derived classes from the template classes #+begin_src ruby :tangle ./app/models/appuser.rb class AppUser < User after_create :create_braintree_customer def create_braintree_customer Braintree.api_key = "bk-54cfa45" self.id = Braintree::...


1

By pass in target directory as path into Clojure code, and use java.io.File.renameTo to move generate plot image file to target dir. Here is the complete story background: https://stardiviner.github.io/Blog/Clojure-Plotting-to-Org-inline-image-in-ob-clojure.html Here is a complete example: #+begin_src clojure :results file link :dir "data/images" :file "...


Only top voted, non community-wiki answers of a minimum length are eligible