Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [org-babel]

feature of Org mode that handles source code for multiple languages. It can execute source code from within Org mode documents, making it convenient for producing literate programming documents and managing reproducible research. Note that [tag:org-babel] is now incorporated into [tag:orgmode] as `working with source code` and no longer a separate extension.

0
votes
0answers
5 views

Rmarkdown-like export of Leaflet for R webmap to html from org-mode

With RMarkdown it's easy to embed an interactive webmap. E.g.: --- title: Some title output: rmarkdown::html_document --- ```{r} library(leaflet) leaflet(width = "100%", height = "650px") %>%...
1
vote
1answer
22 views

use js2-mode instead of js-mode in org babel source

I want to use js2-mode instead of js-mode inside org-babel sources. Is there a way to define a mode for JavaScript inside those chunks? #+begin_src js console.log(1+1) #+end_src
3
votes
1answer
106 views

How to disable noweb prefix lines?

This says that Noweb insertions now honor prefix characters that appear before <<reference>>. And because of that trying to use #+BEGIN_SRC clojure :noweb-ref dep-cljsbuild [lein-...
10
votes
1answer
832 views

Debugging code blocks in org mode

Are there any tools available to make tracing errors in org-mode blocks easier? (I'm working with python specifically) My current workflow is to copy code that works to a source block, and try to ...
1
vote
1answer
83 views

No org-babel execute function for go

#+Begin_SRC go package main import ("fmt") func main(){ fmt.Println("emacs") } #+End_Src ~/.emacs.d/init.el: (when (memq window-system '(mac ns)) (exec-path-from-shell-initialize) (exec-path-...
0
votes
1answer
118 views

ledger in org-babel blocks uses incorrect path data in Windows 10

I am trying to include a ledger data file from an org-babel block. I am using Windows10 and the SciMax emacs distribution. #+begin_src ledger :cmdline bal :results output :exports results !include d:/...
1
vote
2answers
554 views

Linking to c++ libraries in babel code block

The title says it all, and I've included the relevant sections of my file below. I'm trying to create a src block that uses some functionality of the boost libraries, the first src block sets up the ...
0
votes
1answer
159 views

Code block evaluated when exporting, not when publishing

I have this basic org publishing project to test that code blocks evaluation is triggered by publishing in html (org-html-publish-to-html). While exporting through org-mode export dispatcher does ...
0
votes
1answer
42 views

How to prevent org-mode loading babel's major mode stuffs unless entering `org-src-mode`?

I have some Java's scripts in a org file. And I use meghanada-mode in java-mode. Each time I open this org file and do nothing, I get the following error since the mehanada server loaded by java-mode ...
0
votes
2answers
253 views

Cannot Execute Org-Babel Haskell Block

In an org-mode file: #+BEGIN_SRC haskell let x = "test" putStrLn x #+END_SRC yields: executing Haskell code block... if: ‘org-babel-script-escape’ expects a string
0
votes
0answers
15 views

How to export org-babel document with ox-pandoc?

I want to export an org-babel document to html with bibliographies from a .bib file. The org-file is the following: #+TITLE: Test #+AUTHOR: Your Name #+EMAIL: your-email@server.com #+PANDOC_OPTIONS: ...
3
votes
1answer
74 views

Evaluating `org-babel-clojure` blocks returns all form evaluations

I'm trying to set up babel for use with Clojure according to http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-clojure.html#org85bc1ec and I can evaluate code but when I evaluate a block with ...
4
votes
1answer
30 views

How to display intermediate code block results?

Here is an example to let me explain what I would like to achieve: #+NAME: heavy_computation #+BEGIN_SRC shell :results table echo -e "A\t32\nB\t17" #+END_SRC #+BEGIN_SRC python :var data=...
1
vote
2answers
43 views

Babel + Python function definition with for loop causes IndentationError

I am using orgmode and Babel to run Python source code blocks. I noticed that if I define a function that returns a value, and if this function has a for loop inside it, then evaluating it with Babel ...
1
vote
1answer
37 views

How to export org-babel document?

In my .emacs file, I have the following variables: (custom-set-variables '(org-babel-load-languages (quote ((emacs-lisp . t) (R . t)))) '(org-confirm-babel-evaluate nil)) I save this example to a ...
0
votes
1answer
140 views

Tangle only selected src blocks using org-babel on export

I have a document with only several source code blocks that should be tangled. So the structure is: # Some main.org ... #+BEGIN_SRC awk :tangle file1.awk ... #+END_SRC awk ... ...
4
votes
1answer
197 views

Using File Local Variables in org-mode

Is there a way to use file local variables set in an org-mode file in the following contexts: Simply expanding the variable when text is exported (eg: to LaTeX) Passing the value to :var in a babel ...
3
votes
1answer
321 views

ob-ipython error message while evaluating SRC block

I am getting this error when executing any source ipython block such as this one: #+BEGIN_SRC ipython :session :results output drawer # Compute areas and colors import numpy as np import matplotlib....
1
vote
1answer
35 views

How to generate the result file for dot source block and include it with another path in org-mode?

I'm starting to write blogs with org-mode and org-static-blog, but now I'm stuck with a problem respecting exporting graphviz dot file to image file. So I have a code block like this with (setq org-...
0
votes
1answer
25 views

eval elisp code to fill org-babel header arguments

I use many org files with figures generated by source code blocks. By example, in an org mode file long/path/document.org I have: #+BEGIN_SRC dot :file my_fig.png :exports results digraph { A->...
2
votes
0answers
24 views

How to set a tangled parent directory for each subtree in org mode?

Base on this, one can set a global tangled file. However, I'd like to set one directory for each subtree, e.g. for a * Python subtree, in every code block I can set :tangle a.py or :tangle b.py ...
1
vote
0answers
29 views

With org-babel how can I read a result block and pass arguments?

I asked a similar question a few years ago but I never did figure out how to proceed. I ended up aborting my excursion into org-babel. However, I can see how this would be really valuable, to ...
2
votes
1answer
102 views

Org mode elisp in :var in header-args causing max-specpdl-size error

In org mode, :var header arg definitions can actually call other SRC blocks, which is very nice! However I've run into a problem exemplified by the following org file: #+NAME: add3 #+BEGIN_SRC elisp :...
2
votes
1answer
33 views

Setting :stdin with #+call in org-mode shell code block

I've got the following code: #+NAME: example-block1 #+BEGIN_EXAMPLE Lorem ipsum dolor sit amet, consectetur adipisicing elit. #+END_EXAMPLE #+NAME: example-block2 #+BEGIN_EXAMPLE Sed do eiusmod ...
1
vote
1answer
25 views

Export an orgmode buffer without expanding noweb references?

Normally, when I use orgmode's export function on a buffer that contains noweb references, they get expanded, resulting in lots of duplicated code throughout the exported HTML document. Is there a ...
0
votes
1answer
153 views

org-babel-execute-src-block: No org-babel-execute function for R!

In org-mode, attempting to execute the following block... #+BEGIN_SRC R 1+2 #+END_SRC ...gives the error message org-babel-execute-src-block: No org-babel-execute function for R!. I have followed ...
7
votes
1answer
173 views

Converting cURL command to ob-http

I have a whole series of curl commands that I would like convert into ob-http code blocks in a org file (second choice would be to do them in restclient). Here is a simplified sample command: curl -...
1
vote
2answers
195 views

Org-babel. :flags in C code blocks dont work correctly anymore

I'm trying to run current code block #+HEADERS: :includes <math.h> <stdio.h> :flags -lm #+HEADERS: :var x=1.0 :var y=4.0 :var z=10.0 #+begin_src C :tangle trying double pi = 4*atan(1); ...
1
vote
1answer
15 views

Org babel R: why is 'NA' replaced with 'nil'

When using R in org mode source blocks, any NA (i.e. missing) values in tables get replaced with nil. Why is this? And is there a way to change this (globally, or at the file level)? I regularly ...
0
votes
1answer
32 views

is there something like org-babel for arbitrary major modes? [duplicate]

org-babel allows editing source code of arbitrary modes inside an .org file. I'd like to do this (with different syntactic markers) inside my major mode, but org-babel is very specific to org. Is ...
1
vote
1answer
95 views

org-babel captions on results don't export to LaTeX?

I hope the following complete minimal example is self-explanatory. It contains my question. It should run without error messages in org-babel. I looked at the six related suggested questions on the ...
7
votes
2answers
177 views

It is possible to instrument a literate Org-mode configuration file with a backing Emacs Lisp file?

It is a common practice to write Emacs configuration files using literate-programming style in Org mode. Unfortunately, while improving readability, this comes with significant programming ...
0
votes
1answer
27 views

Catching warnings from sh source block

I've started on Learn C The Hard Way and want to collect my work in org mode. Executing rm ex1 && CFLAGS="-Wall" make ex1 in the terminal returns cc -Wall ex1.c -o ex1 ex1.c: In ...
1
vote
2answers
204 views

org-babel-execute:clojure handle :file result error

-- UPDATE -- Declare what my code is trying to do: I want to let org-babel insert an inline image link which is generated by Clojure code. Here the image is generated by Incanter's function save. ...
0
votes
1answer
48 views

org-babel uses wrong directory during execution of source blocks (org-compile-file error)

I'm experiencing a strange error when trying to execute/compile a LaTeX source block in org-babel. A simple example looks like this: #+NAME: latex1802142321 #+BEGIN_SRC latex :results raw :file ...
0
votes
0answers
45 views

Why the difference when executing a shell script from a :session

I'm trying to do some git archeology but I've run into some weirdness with orb-babel and sub-shell expressions: #+name: get-aggregate-stats-debug #+header: :dir ~/lsrc/qemu/qemu.git #+begin_src shell ...
8
votes
1answer
117 views

Does org have any “inverse-tangle” operations e.g. for collaborating with non-org users?

I would like to write my own notes/tests/code in org and then use org-bable-tangle to produce source files. However, all of these files are subject to version control and hence subject to change from ...
0
votes
1answer
42 views

Exit hook for org-src-mode

org-src-mode-hook is run upon editing a source block using org-edit-src-mode. Is there a way to set behaviour upon exiting editing a source block? In particular I would like to run blacken-buffer ...
1
vote
0answers
45 views

C-c ' for editing all code blocks (to handle imports and variables)?

The Org manual says: C-c ' for editing the current code block. It opens a new major-mode edit buffer containing the body of the ‘src’ code block, ready for any edits. This feature is sweet. ...
2
votes
1answer
264 views

Org-babel Python with :session

I don't know what happened with org-babel and Python recently. My intuition and my experience with preparing lectures last year was that the :session option would cause Org Mode to capture all the ...
8
votes
2answers
2k views

Python org-mode source block output is always ': None'

This is my source block: #+BEGIN_SRC python print "hello" #+END_SRC The output is always: #+RESULTS: : None This is my org-babel configuration: (org-babel-do-load-languages 'org-babel-load-...
2
votes
1answer
34 views

Can I insert a prefix to Org Babel source code lines on export?

Like, say I have a shell script source code block. #+BEGIN_SRC shell echo 'Hello World!' #+END_SRC On export, I want the code text to pick up a dollar sign, so $ echo 'Hello World!'. But I only ...
0
votes
1answer
55 views

How do I ensure org-sbe is consistently passed a string when copying tables

I'm trying to transform the data from one table to another however I can't do it with built in functions so I have to use org-sbe to call some elisp: #+tblname: clues | 02a8 | 0050 | 5012 | 2225 |...
0
votes
1answer
73 views

Choose individual startup visibility of org-mode's source blocks

In org-mode, how could one specify the visibility state of individual SRC_BLOCKs when a file is opened? org-mode provides the variable org-hide-block-startup to specify if all source blocks are shown ...
1
vote
1answer
63 views

Is it possible to have shared #+PROPERTY: between multiple org files?

I'm working with org-mode and org-babel to query a PostgreSQL database. It's pretty cool setup and I love it. At the moment, I have multiple org files with the same database property configuration ...
1
vote
1answer
35 views

org-babel-execute:sql: reciving erros and no returns

#+name: Part 1 Task 1 #+header: :engine mysql #+header: :dbhost localhost #+header: :dbuser subject #+header: :dbpassword 1234 #+header: :database hmsec #+begin_src sql SELECT sensorId, type, ...
1
vote
1answer
81 views

How can I tail/stream output when evaluating org babel shell blocks?

I learnt about asynchronous execution of org babel shell code blocks, thanks to: How is #+BEGIN_SRC sh :results drawer different to #+BEGIN_SRC sh I want to know if it's possible to tail/stream the ...
0
votes
0answers
16 views

org-babel interpreter prompts

is it possible to get org-babel to output the interpreter prompts and sessions, as if each expression in the src block had been entered into the repl... e.g. something like: #+begin_src ruby :output ...
0
votes
1answer
35 views

Org-mode export gets weird symbols at the end of each line while exporting to HTML

I got some source blocks in my org document like this one: #+BEGIN_SRC ipython print("Hola") #+END_SRC When the org file is exported to html (and only to html) I got weird symbols at the end of each ...
3
votes
0answers
49 views

Apply ANSI color escape sequences for Org Babel results

Feature There is a nice built-in Emacs feature to colorize strings with ANSI color escape sequences. So evaluating the following Elisp code, will insert the "Test text" at the point with proper ...