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.

8
votes
0answers
391 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 ...
4
votes
0answers
223 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
374 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 ...
4
votes
0answers
91 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
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 ...
3
votes
0answers
94 views

Eval SQL in Org Babel using sql-connection-alist for credentials

I would like to evaluate SQL source blocks in Org Babel using the connections I have set up in sql-connection-alist from sql-mode. This way I can save database credentials in a private (Elisp) file ...
3
votes
0answers
308 views

How to generate inline plot result for ob-clojure?

Question: How to generate inline plot image result in Org-mode babel clojure src block? I tried some ways: First way: use :results file :file "clojure-babel-figure-result.png" #+BEGIN_SRC clojure :...
3
votes
0answers
141 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
157 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 ...
3
votes
0answers
112 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
119 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

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
162 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
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 ...
2
votes
0answers
58 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
146 views

Org-babel: Set root dir for tangled files

I have started using org-babel for a larger project, and have found the readthedocs to be a great resource. I have been using tangling to generate code from documentation, however setting the export ...
2
votes
0answers
33 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
79 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 ...
2
votes
0answers
35 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
174 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
173 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
109 views

How do I attach a custom function to process org-mode babel shell output?

I have a a function (defun display-ansi-colors () (interactive) (let ((inhibit-read-only t)) (ansi-color-apply-on-region (point-min) (point-max)))) that I got from here: http://stackoverflow....
2
votes
0answers
86 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 ...
2
votes
0answers
236 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="...
2
votes
0answers
406 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
37 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
87 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
198 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
135 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
201 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
289 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
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 ...
1
vote
0answers
25 views

Bilingual text in .org mode and xelatex

I would like to typeset bilingual (English, Hindi) in emacs .org mode using mangal font available on windows . It has to be exported using xelatex. Kindly explain step by step setup for the same . I ...
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. ...
1
vote
0answers
80 views

how to “slow” down the execution of code blocks

on OSX 10.13.4 with emacs 25.3 and org-mode 9.1.12. Python is 3.5.2 with matplotlib 2.2.2 I am trying to find a way to have org-mode babel for python to slow down in some of the points of my code ...
1
vote
0answers
41 views

get contents of source block

I'm trying go get the src block contents with (org-element-property :value (org-element-at-point)), but when I apply this on a block like: #+BEGIN_SRC emacs-lisp (print "foo") #+END_SRC the result ...
1
vote
0answers
53 views

Save org-babel output with org-attach

I am using org-babel to write R code in Emacs org-mode. Here's an example: #+BEGIN_SRC R :session *R* :results output graphics :width 5 :height 5 data(AirPassengers) AP <- AirPassengers plot(AP) ...
1
vote
0answers
117 views

org alters output of bash code blocks when run with :session

I am running a short bash command from an org mode code block, using the program fold to wrap it at 60 characters. If I run the code without a session argument, the results display as expected. ...
1
vote
0answers
61 views

Problem evaluating a `sage-shell-mode` function through `ob-sagemath`

I'm trying to use sage-math within an org-mode file. So far I've been able to configure the sage-shell-mode package (I'm impressed that sagemath can be installed in Debian using the package manager), ...
1
vote
0answers
37 views

how can I see the result of 'ping -c 5 127.0.0.1' live using org babel session

https://github.com/whacked/ob-shstream/blob/master/ob-shstream.el There's an add-on for org babel that let's you see streaming output of bash shell blocks. It's documentation reads like this: ;; the ...
1
vote
0answers
162 views

How is #+BEGIN_SRC sh :results drawer different to #+BEGIN_SRC sh

While reading http://www.howardism.org/Technical/Emacs/literate-devops.html I saw the author recommending #+BEGIN_SRC sh :results drawer for "time-consuming and verbose" commands. (I do a ...
1
vote
0answers
46 views

Problem execution scope org-babel in shell on windows 8

I just discovered that in order to run a sequence of shell commands under the same scope (same shell session) I have to add a hash at the end of the line. Example When I try to run the following ...
1
vote
0answers
48 views

How do I associate org-mode source buffer to appropriate session?

I want to execute org-babel code blocks associated with a session without locking up Emacs. I found the ob-async package, but it doesn't have support for sessions yet. I've found that opening the code ...
1
vote
0answers
83 views

Export HTML inline image results for Jekyll

I'm trying to follow the recipe for exporting Org-mode documents for processing by Jekyll. My publishing org-publish-project-alist is configured to place exported html in my _posts directory and take ...
1
vote
0answers
89 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 ...
1
vote
0answers
166 views

org babel exports code blocks even if I tell it to export results instead

How can I make org-babel only export results, not code? The only way I've found to suppress code from appearing in the output is to comment out all the code blocks manually. I tried adding :exports ...
1
vote
0answers
151 views

How can I use #+CALL with multiple arguments?

I'm trying to learn how to use the noweb syntax and advance my knowledge on the possibilities of org babel. For that, I'm trying to get the following an example to work that 1. uses noweb syntax and 2....
1
vote
0answers
89 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 ...
1
vote
0answers
217 views

Can I write to a local file from a remote session using an Org-babel R code block?

I'd like to find a way to evaluate my R code remotely, but insert images into my local org file. I use R code blocks in my org files and insert images into the org file with something like this: #+...
1
vote
0answers
184 views

Choosing which font for html export syntax highlighting?

Exporting org mode documents to html with (setq org-src-fontify-natively t) will carry syntax highlighting into the exported code blocks. Zenburn looks awful exported while Leuven/others looks ...