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.

Filter by
Sorted by
Tagged with
2
votes
1answer
498 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 ...
0
votes
1answer
68 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 ...
2
votes
1answer
256 views

Org Mode's :output-dir and :file-ext arguments cause ALL output to be saved to files

Org Mode's Babel for executing code blocks provides two header arguments, :output-dir and :file-ext that were clearly intended to be used in the global document header, applying to all blocks. They ...
1
vote
0answers
86 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 ...
2
votes
1answer
1k views

Python in org babel will not work

I've recently moved to a new computer and cannot get org babel to work with Python (it worked fine on my old machine). I'm using OS X 10.12.6 with Emacs for Mac OS X based on Emacs 25.3 with org-mode-...
3
votes
1answer
202 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
0answers
42 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 #+...
1
vote
0answers
45 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 ...
2
votes
2answers
482 views

ob-tangle or not?

I'm experimenting with Uncle Dave's config which is using a minimum init.el to launch config.org, which is full of elisp babel source blocks. Here's his relevant launching code: (when (file-readable-...
4
votes
1answer
288 views

How do I generate & tangle source code in a different language?

In an org file, I have a Perl source code block that generates SQL code. The Perl code is to be part of the exported document, but the SQL code is not; it is supposed to be tangled to the ...
0
votes
1answer
111 views

Trouble with org-export-before-processing-hook in .emacs

When I eval (add-hook 'org-export-before-processing-hook #'org-update-all-dblocks) in an emacs session, function org-update-all-dblocks seems to be called at the preprocessing stage of export, as ...
3
votes
2answers
541 views

Managing code libraries with org-babel

I want to take a literate programming approach to managing my library of code snippets with org-babel. I have a ~/Code folder which I use to save various org-mode documents, each of which contains a ...
2
votes
1answer
475 views

Querying remote postgres from org

this is a bit complicated, please bear with me I want to use org-babel to query postgresql, and I can do it for DBs that I can access directly from my localhost: #+begin_src sql :engine postgresql :...
1
vote
0answers
66 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
1answer
264 views

Force org to use `:` instead of `begin_example` for source block output

When executing a source block in org mode with the output set to verbatim, it will sometimes wrap the results in an #begin_example block, and sometimes it uses : symbols at the beginning of the line. ...
3
votes
0answers
90 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
187 views

How to make org-babel call all remote code blocks under a specific headline?

For example, I have following org file: ***** user level ****** copy system service file At first copy system's systemd service file to systemd user level. by check it out, and tangle it to target ...
2
votes
1answer
776 views

How to execute sudo command in org-babel in relative path under current working directory

I want to execute sudo command in org-babel like this: #+begin_src shell :dir "/sudo::" :cache no make sudo make install #+end_src It works fine. It use TRAMP /sudo: method. But I need to execute ...
1
vote
2answers
652 views

Org-babel: using properties as code block header arguments, how to make it work?

I am able to execute SQL block with the following: #+NAME:test-1 #+BEGIN_SRC sql :noweb no-export :tangle :engine mssql :cmdline "-S localhost -U SA -P myPassword" select * from OtherDW.dbo....
0
votes
1answer
373 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 ... ...
1
vote
0answers
387 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. ...
4
votes
4answers
886 views

literate programming: do folks revise tangle blocks or make copies

So I'm making a website using an org document and tangling. I've created the basic structure of the site using * file coolsite.org #+BEGIN_SRC sh rails new coolapp #+END_SRC This creates a app/...
1
vote
1answer
76 views

Is this a bug? emacs freezes when doing “sudo service apache2 status” inside a org babel tramp remote code block

I think I've found a bug with emacs+org+babel. This block runs fine #+BEGIN_SRC sh :dir /ssh:ubuntu@54.175.231.31:~/ :exports both :results output sudo service --...
1
vote
2answers
301 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
107 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
1answer
83 views

How to write this advice for inject code into let-binding?

I want to write an advice on original code. But don't know how to write it in my case. I just did some modification, and do an diff. Hope the you can understand what I need. Here is the diff ...
5
votes
1answer
224 views

switch-buffer for literate programming

When doing literate programming, I do web development in a single org file, and do org tangle to generate the relevant html and css files. This works, for a few hours/days. When the number of files in ...
2
votes
1answer
263 views

Org-mode: Get src block result inside block definition for clocktable

I'm trying to create a clocktable that starts recording working time at the date of the last commit. So far I've got a src block and I'm satisfied with the resulting date, I'd like to include this ...
5
votes
1answer
380 views

Metaprogramming org-mode

My aim is to write dynamic reports which will be generated using a base skeleton file and snippets that correspond to and parametrise the particular issues. These issues are all content-wise similar ...
0
votes
1answer
141 views

Exist an ob-erlang for src code block on org mode

I'm looking for an ob-erlang library in order to execute erlang in source code blocks in org-mode; I looked on the language table, googled and on github and I didn't fin anything for erlang. I know ...
6
votes
1answer
391 views

Org-Mode: Using Source Code Blocks in Table Formulas

I would like to use source code blocks in org-mode table formulas using something similar to: #+NAME: square #+BEGIN_SRC python :var x=0 return x**2 #+END_SRC | 1 | 1 | | 2 | 4 | | 3 | 9 | #+TBLFM: $...
0
votes
1answer
304 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 ...
3
votes
1answer
666 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
0answers
136 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), ...
0
votes
1answer
487 views

How to pass compiler flag "-std=c++11' to ob-C?

Trying C++ in org-mode code block, but don't know howto pass the compiler flag like -std=c++11 to the code block? My code block is like: #+BEGIN_SRC C++ :includes "<memory>" std::...
0
votes
0answers
144 views

Equations in org-reveal presentation

I've installed reveal.js and org-reveal, and they are working as expected. Even, I'm getting the equations! However, the point with the equations is the following: If I introduce directly the LaTeX ...
0
votes
1answer
46 views

Restoring point when tangling current block

When I do C-u C-c C-v t to tangle the code block at point, my point moves to the head of the code block. How can I prevent that point movement.
0
votes
1answer
488 views

How to specify buffer local variables for the edit buffer of org source blocks?

Consider the following org-file. #+NAME: example-src-block #+BEGIN_SRC emacs-lisp (defun my-message () "Issue my message." (message "Within the emacs-lisp source block.")) #+END_SRC How can the ...
2
votes
1answer
326 views

noweb function call with variable arguments

I get error "reference y not found in this buffer" when trying to evaluate cubed-plus-cubed: #+NAME: cubed #+BEGIN_SRC python :var x=3 return x * x * x #+END_SRC #+RESULTS: cubed : 27 #+NAME: cubed-...
4
votes
1answer
862 views

How to display both output and value results in org mode for a source code block?

I have the following: #+BEGIN_SRC lisp :results value (dolist (x '(1 2 3)) (print x)) #+END_SRC #+RESULTS: : NIL I want my results block to contain both the output and the value for my ...
1
vote
0answers
48 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
1answer
131 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 ...
1
vote
0answers
299 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 ...
7
votes
1answer
354 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
339 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); ...
0
votes
1answer
182 views

typesetting matrix output from maxima using org-mode

How can I make org-mode typeset matrices output from maxima? For example, the following code produces tex output that display #+BEGIN_SRC maxima :results raw m: matrix([1, 2], [3, 4]); tex(m); #+...
2
votes
2answers
154 views

How to find START and END of #+RESULTS region with elisp functions?

I want to call (recode-region) on sh code block results in :post header attribute. So it needs START and END values. Is there a way to define of RESULTS block content boundaries for it ?
2
votes
0answers
39 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 #+...
0
votes
1answer
113 views

#+NAME: in a property drawer

I want to be able to add a #+NAME to a property drawer that would name a code block thats split between sub org headers. Im at loss on how this is done? this is a current example of a tmux conf thats ...
1
vote
1answer
275 views

key binding to invoke more than two commands

I'm in org-mode and would like to have C-c C-c ' run org-edit-special then mark-whole-buffer then indent-region then org-edit-special to get back out again. I've tried (defun my-run-org-babel-...

1 2 3 4 5 10