Questions tagged [org-babel]

org-babel is an extension of GNU EMACS org-mode, for executing and evaluating source code from within org-mode documents. Along with org-mode exporting facilities, it can be effectively used for multi-languages literate programming and reproducible research.

Useful Links:

Babel: active code in Org-mode

Org-mode manual: section 14.5

How to Use Emacs Org-Babel Mode to Write Literate Programming Document in R Language

153 questions
30
votes
4 answers

How can I load bash (as opposed to sh) in org babel to enable #+BEGIN_SRC bash?

I see references to, and examples that use #+BEGIN_SRC bash But in my org mode version (elpa, org 20150316) in the menu of customize-variable org-babel-load-languages, there is no "bash" item, only shell. Attempting to evaluate code such as…
mzimmermann
  • 1,002
  • 2
  • 9
  • 14
19
votes
4 answers

How to set up org-babel for Haskell with Stack

I'm running: GNU Emacs 24.4.1 Stack Version 1.3.3 org-mode haskell-mode I've looked through: Emacs Org-Mode & Literate…
Mittenchops
  • 18,633
  • 33
  • 128
  • 246
19
votes
4 answers

How do I prevent org-mode from executing all of the babel source blocks?

I have an org file with lots of babel source blocks in it that only need to be re-executed when the code is changed. How do I prevent org from executing all of the blocks during export? In other words, set them all to manual execution only? I would…
shader
  • 801
  • 1
  • 7
  • 25
16
votes
1 answer

Literate Programming using org-babel

I am on a literate program using org-babel. My source is structured like so, -imports -utility fns -game structure - detailed explanations This is the normal structure of the code, what I would like to do is move explanations of the utility fns to…
Hamza Yerlikaya
  • 49,047
  • 44
  • 147
  • 241
16
votes
4 answers

Indent code in org-babel src blocks

In an org-mode file, with code like the following: #+begin_src emacs-lisp (add-to-list 'org-tab-before-tab-emulation-hook (lambda () (when (within-the-body-of-a-begin-src-block) …
user103576
  • 360
  • 1
  • 3
  • 8
15
votes
2 answers

How to input password when evaluate code block in Emacs org-mode?

I have a shell code block in Org file. And there's "sudo" command in it. So I should be asked to key in password. But when I evaluate it, it just return error for "sudo" command. Is it there's any way to make the evaluation kind of interactive?
enchanter
  • 884
  • 8
  • 20
14
votes
1 answer

Export org-mode code block and result with different styles

I am preparing a presentation using org-mode and babel, and want to export to beamer pdf. In the output, the source code and the results are with the same style (verbatim in latex). Thus it is difficult to distinguish them. Would it be possible to…
Yi Wang
  • 515
  • 3
  • 12
12
votes
1 answer

Capture output from a shell command with babel in org-mode

I want to know about my networking hardware. lspci | grep -i net From the terminal, this command gives the following output: 00:19.0 Ethernet controller: Intel Corporation 82577LM Gigabit Network Connection (rev 06) 02:00.0 Network…
wdkrnls
  • 4,548
  • 7
  • 36
  • 64
11
votes
2 answers

Capturing the output of "diff" with org-babel

I'm trying to capture the output of diff with org-babel, but for some reason it's not working. For the files 1 a b c 2 a c b diff 1 2 called from the command line returns 1c1 < a b c --- > a c b But with org-babel, nothing: #+begin_src sh …
Alex
  • 1,416
  • 4
  • 16
  • 42
10
votes
2 answers

byte-code: Symbol's value as variable is void: org-babel-tangle-lang-exts

I had Emacs working pretty well and then I restarted my computer. Now this block of code prevents me from loading my init-files: (require 'ob-clojure) (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . nil) (R .…
wdkrnls
  • 4,548
  • 7
  • 36
  • 64
9
votes
2 answers

Execute Java code block in org mode

I can't seem to be able to evaluate Java code snippets in org mode. Here is what I have #+BEGIN_SRC java public class Main { public static void main(String[] args) { System.out.println("hello world"); } } #+END_SRC I get the…
user3146687
  • 389
  • 1
  • 3
  • 11
9
votes
3 answers

Emacs org-mode: define variable in buffer and access variable

I would like to define a buffer wide variable in an org-file and use the value from this variable later for, e.g., define the width of images for latex export. Is there a way how this can be done? Can this be done using #+CONSTANTS:? Ideally, it…
jotsetung
  • 121
  • 1
  • 4
8
votes
4 answers

org-mode html export

I have a org file with source, documentation and latex code. Latex stuff draws a bunch of graphs explaining how functions interact with each other. According to, http://orgmode.org/manual/LaTeX-fragments.html org-mode should export latex code as…
Hamza Yerlikaya
  • 49,047
  • 44
  • 147
  • 241
8
votes
1 answer

no output from org-babel code using R

Org 8.2.10 Emacs 24.5.1 OSX 10.10.3 #+BEGIN_SRC R 1 + 2 #+END_SRC #+RESULTS: : 3 but with #+BEGIN_SRC R x <- rnorm(100) summary(x) #+END_SRC #+RESULTS: "Code block produced no output" and the *Messages* buffer contains: Error reading…
user2162871
  • 409
  • 3
  • 10
8
votes
3 answers

How to org-babel-tangle only one code block?

I'm generating multiple files in one .org file, with multiple source code blocks. For example: #+begin_src rst :tangle file1.rst :noweb yes <> #+end_src #+begin_src rst :tangle file2.rst :noweb yes <> #+end_src Is there any way to…
joon
  • 3,899
  • 1
  • 40
  • 53
1
2 3
10 11