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.

121 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
10
votes
0answers
496 views

Edebug orgmode source code blocks with input variables

What is the standard method to debug emacs-lisp orgmode source code blocks with input variables as header arguments? I found the hacky solution to insert the following snipped in front of a source ...
5
votes
1answer
51 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=...
5
votes
0answers
170 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 ...
4
votes
0answers
241 views

Org-babel and anaconda-mode in src blocks

I practice python literate programming with tangling to generate a full project structure. There are dependencies between modules and packages, and so I will say in the C-c ': #+begin_src python ...
4
votes
0answers
272 views

Indentation using multiple org src block

So, say I have a literate org file as follows: #+TITLE: Random Scrap * Do something :PROPERTIES: :tangle: scrap.pl :comments: org :END: #+BEGIN_SRC perl sub my_func{ my $var = pop; #+END_SRC ...
4
votes
0answers
98 views

Get describe-key links to bring me to org-mode config files, not .el config files?

For my Emacs configuration, I use a literate programming setup. My config files are in org-mode format, and my init.el file consists mostly of org-babel lines like (org-babel-load-file "~/emacs/...
3
votes
1answer
359 views

org-export latex pdf output does not render svg

I tried out this section of code from this repo #+LATEX_HEADER_EXTRA: \usepackage{svg} ... #+PROPERTY: header-args :eval never-export :file-ext svg ... #+NAME: sequence12422 #+BEGIN_SRC plantuml :...
3
votes
0answers
91 views

Prevent Org mode from raising Emacs frame while exporting to PDF

Some of my org mode files take a long time to export because they include code for number crunching that is executed during export (via Org Babel) . I usually minimize the Emacs frame while the ...
3
votes
1answer
149 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 ...
3
votes
0answers
173 views

Elpy Autocomplete in org-edit-special

I'm using org-babel with python source blocks to put break my code into sections. The issue I'm having is I don't get any autocomplete suggestions based on the code in other blocks. Is there any ...
3
votes
0answers
155 views

Literate agda programming in org-mode

How could I write literate (and exportable to latex) Agda code in org-mode? Org-babel would be a great option, but there is no ob-agda2 (I think?). I have tried defining an org-babel-execute function ...
3
votes
0answers
302 views

how to expand org-mode macros in HTML blocks in export to HTML?

I'd like to use org-mode macro replacement to expand macros inside HTML blocks in org-mode export to HTML. I'd like this... #+MACRO: event-url bar #+HTML_HEAD: <meta property="og:url" content="...
3
votes
1answer
145 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-...
3
votes
0answers
201 views

Curly braces inside a body of the org-mode inline source block

I would like to use curly braces inside a body of the org-mode inline source block. Since the body itself is delimited with curly braces it seems impossible. The problem occurs when additional pairs ...
3
votes
0answers
137 views

Org-babel noweb expansion when sending C-c ' buffer to python shell

I'm doing literate programming with Python. In my workflow I like to test the block with python-shell-send-buffer and ipdb debugger. However if the block contains a noweb reference then the code is ...
3
votes
0answers
601 views

org-mode babel german

I am trying to export an org file to PDF via LaTeX but in German. I set #+LATEX_HEADER: \usepackage[ngerman]{babel} but when exporting org-mode adds english to the babel options. That causes all the ...
3
votes
0answers
156 views

Prevent Org from escaping latex results

During export, Org generates this: \begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm, semithick] \node[initial,state] (A) \{\$q$_{\...
3
votes
0answers
114 views

Org-mode Babel: Evaluating code in header of code block for tangling

Is there a straightforward way to use a variable for the tangle file? For example, I want to tanlge my file into the directory files. For multiple files I could do #+begin_src python :tangle files/...
3
votes
0answers
150 views

Jump sequence for placeholders in yasnippet not working in org-property blocks

I use the yasnippet bundle and it works like charm. When I want to include placeholders in a PROPERTIES section of an org-document it is not working. Here's the snipper: #type: snippet # -- :...
3
votes
0answers
167 views

Launching in daemon mode crashes emacs while loading configuration from .org file

I've been using literate programming using org-mode for my initialization file. I've a init.el which loads a org file converts it to .el and uses it as startup file. Here is my configuration files. ...
2
votes
0answers
26 views

org-babel-tangle-file multiple files into a single output

Is there a way to tangle an org file with #+INCLUDE: statements? Or other ways to tangle multiple org files into a single output?
2
votes
1answer
86 views

Jumping from a source block to the tangled file

Is there an inverse of org-babel-tangle-jump-to-org allowing one to jump from a source block to the corresponding place in the tangled file?
2
votes
0answers
219 views

org-mode/babel and zsh: Getting shell sessions to work

I've been trying to get shell code blocks with sessions to work, but not entirely succeeding. My setup: emacs 26.1 (spacemacs) org-mode 9.2.2 default shell: zsh 5.7.1 Everything seems to work fine ...
2
votes
0answers
173 views

Print output from org code block immediately

I have an org mode file I use to run some moderately long analyses. Evaluating individual blocks may take 15 minutes to an hour or so. I usually wrap longer bits with calls to date, so I can later ...
2
votes
0answers
59 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
0answers
104 views

Setting org-babel-load-languages in .dir-locals.el

As per the title, I'd like to set the org-babel-load-languages (to contain ditaa and calc languages) for a specific project only. The only solution I found so far is this one ( (org-mode . ...
2
votes
0answers
43 views

Re-apply table formulas on org-mode export

I'm using an org-mode file to do some filesystem monitoring. To that purpose I have a table in which I'm calling code blocks through org-sbe in the formulas. It looks like this: #+NAME: part-size #+...
2
votes
0answers
40 views

Is there a way to time babel code blocks?

Is there a way to do something like the example below to time the execution of any babel code block ? #+BEGIN_SRC sql :timeit #+END_SRC #+results 40s results here #+BEGIN_SRC python :timeit #+...
2
votes
0answers
274 views

org-mode: Can I use a custom mode for org-src-lang-modes and still get syntax highlighting?

I'm trying to get syntax highlighting with org-mode source blocks using a custom language mode for editing JavaScript. I use js2-mode with a bunch of minor modes, rather than js-mode, which is what ...
2
votes
0answers
271 views

Org sql header args dont seem to work why?

Can anyone explain why this does not work, i want to set the parameters global to the current document using PROPERTY but this does not work and results in this error. (wrong-type-argument stringp ...
2
votes
0answers
276 views

org-mode babel progress indicator?

When I run a process in the Mac Terminal, it gives me an indication of its progress. Here we see that I am 31% complete on downloading the latest org-mode: How can I get this same sort of progress ...
2
votes
0answers
102 views

noweb reference aware org-edit-special

Is there a way of splitting a src block into several blocks while keeping them together with noweb reference syntax and editing them using org-edit-special in such a way that would take into account ...
2
votes
0answers
744 views

use local tikz library in org-mode

would like to use a custom tikz library with org-mode. https://github.com/jluttine/tikz-bayesnet The following example works fine. :) #+begin_src latex :file fsa.pdf :packages '(("" "tikz")) :border ...
2
votes
0answers
41 views

Org-babel `set` src-block-info?

We have org-babel-get-src-block-info and org-babel-view-src-block-info. Is there anything similar to programatically (or preferably interactively) changing the choices from the src-block-info? If ...
2
votes
0answers
103 views

How to specify number of digits to print from a table using babel?

New to org/babel, so forgive me if this doesn't make sense. I have some code (in R) that produces a table. I also specify (in R) the number of digits that I want with options(digits = 2). When I run ...
2
votes
0answers
241 views

org-babel evaluation of code block always creates new window

Running org-ctrl-c-ctrl-c to evaluate a src block in an org file behaves strangely with windows. With a single window in the frame, it spawns a new window looking at the same buffer in a split and ...
2
votes
0answers
269 views

Stopping a runaway process using C-c C-c

When i evaluate some source code blocks using C-c C-c sometimes i might have an error and the system hangs on me . The only way to exit at this point is by quitting emacs. Are there any solutions to ...
2
votes
0answers
223 views

Format <<<target links>>> in org-mode for printing

Is there a way to format target links created by org-mode when using radio targets such as the following: <<<some text>>> where that some text is linked back When outputting to ...
2
votes
0answers
313 views

How do I get comments in a noweb expansion?

Given the org-mode file * File Description :PROPERTIES: :comments: org :tangle: file.sh :noweb: yes :END: ** A function call This is foo #+BEGIN_SRC sh :noweb-ref myfunction :tangle no ...
1
vote
0answers
23 views

How to pass through variables through src blocks to other src blocks

I am using Emacs version 26.3 and Org Mode version 9.3.6. My goal is to have several different #+CALL: lines, each using a different value of some header argument (in the example below, that is inarg)...
1
vote
1answer
12 views

Org mode evaluating propertized string removes properties

See the following code block: #+BEGIN_SRC emacs-lisp (setq s #("abc" 0 3 (face (:foreground "red")))) (pp s) #+END_SRC #+RESULTS: : #("abc" 0 3 : (face : (:foreground "red"))) which is as ...
1
vote
0answers
16 views

org-babel python :session names matter

For example, I get #+BEGIN_SRC python :session sdfjkl :results output import numpy #+END_SRC #+RESULTS: : Python 3.8.0 (default, Oct 23 2019, 18:51:26) : [GCC 9.2.0] on linux : Type "help", "...
1
vote
0answers
19 views

Multiple insert point org source code insert

I know that we can customize the source code expansion <s TAB using something like this (add-to-list 'org-structure-template-alist '("s" "#+BEGIN_SRC ? :results raw replace drawer ...
1
vote
0answers
32 views

Can I specify tags as a property to avoid cluttering the headline?

Having tags in the headline clutters the view and is quite distracting when the tags are not directly pertinent to it. An example of this is the noexport tag which describes what to do with the ...
1
vote
1answer
19 views

What is the `'inf-template` file in the ob-template.el file (template for creating new babel language)

Because the options provided by the mathematica.el file in org-contrib are quite limited, I am trying to create a new, extended, mathematica.el file. As explained on the org language development page, ...
1
vote
0answers
80 views

(solved) Error “Tangled 0 code blocks from [file]”

I'm writing a bash script with literate org-mode. The header of the file is: #+TITLE: start-lcs #+AUTHOR: Stahlberg #+EMAIL: stahl at gmail dot com #+DATE: 2019-11-02 #+PROPERTY: header-args:sh :...
1
vote
0answers
174 views

How to execute a org-babel source block within the working directory?

Say you have the following org-babel source block: #+BEGIN_SRC latex :results raw :file test.pdf \LaTeX #+END_SRC When executing it, org-babel will do the actual compilation in a temporary directory ...
1
vote
0answers
57 views

Org-mode results verbatim not working for Scheme code

I have the following source block of Scheme code: #+BEGIN_SRC scheme :results value verbatim append (define shift (lambda (list-with-sublists) (cond [(pair? (car list-with-sublists)) ...
1
vote
0answers
16 views

Highlighting the currently active org-Babel block

I want to do something similar to hl-line-mode but not sure if it has been implemented already and how it can be implemented. The goal would be to set two color schemes for the #+begin and #+end ...
1
vote
1answer
92 views

Org-babel python with session breaks output

If I run the following code block: #+BEGIN_SRC python :results output print(" /|") print(" / |") print(" / |") print("/___|") #+END_SRC I get the result as expected: #+RESULTS: : /|...