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
3
votes
0answers
129 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 ...
1
vote
1answer
140 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 ...
1
vote
0answers
227 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
1answer
1k views

No org-babel-execute function for calc?

In org-mode: #+BEGIN_SRC calc :var x=5 :var y=2 2+a*x**y #+END_SRC returns No org-babel-execute function for calc! How do I enable calc for org-babel-execute?
5
votes
1answer
2k views

How to word wrap within code blocks

I'm trying to get the formatting right for an org-mode file being exported to pdf. I set 'org-startup-truncated' to nil and that has resolved my word wrapping issues for non code blocks. But I ...
1
vote
1answer
170 views

Python org-mode babel output: column headers misaligned

I'm trying to view some rows of a pandas data frame. Is there a way to prevent the ">>> ..." from appearing before the headers, so that column names are aligned with the data? #+NAME: simulate-data #...
1
vote
1answer
375 views

org-mode table-formula and code-blocks: function parameter is cut off on whitespace

In Org-mode working with 'src' code blocks and table formulas together, org-mode cuts of the cell strings at the first whitespace character. I.e.: having a cell with Hello World the 'src' code block ...
2
votes
1answer
163 views

Is it a default keybinding to insert #+BEGIN_SRC […] #+END_SRC?

I've searched the manual and I didn't find anything useful. It's annoying to write every time the tags to surround the code, and I'm surprised that org doesn't provide a macro to avoid a so boring ...
2
votes
2answers
301 views

org-babel problem printing separator rows to org-mode table

I found here in the org manual how to output from an org-babel source-code block to an org-mode table, namely through something like #+header :results output table I have had some trouble getting ...
2
votes
2answers
198 views

How to feed range from org-table filled with strings to code-block via tblfm?

Following Situation: I would like to calculate some fields from an org-table filled with strings. There are many tables which all could share the same lisp-code. The lisp-code is rather complex and ...
2
votes
1answer
475 views

execute named org-bable source block from elisp

I want to execute selected source blocks in the active buffer. For example for the following org-mode file, #+NAME: snippet1 #+BEGIN_SRC emacs-lisp (message "snippet 1") #+END_SRC #+NAME: ...
3
votes
1answer
74 views

How to append header arguments to result code src block?

For example, I have an src code block which can generate another code block: #+BEGIN_SRC sh :results code :wrap systemd systemctl --user cat rslsync.service #+END_SRC #+RESULTS: #+BEGIN_systemd # /...
1
vote
2answers
424 views

How to make Org-Babel support tangel to su/sudo file with tramp-sudo?

I hope to let org-babel can tangle to root permission file with tramp-sudo support like the following format: #+BEGIN_SRC clojure :dir /sudo:: :tangle "/etc/kk.clj" ... #+END_SRC But it does not ...
3
votes
2answers
440 views

How to export multiple graphs/plots per code block in org-mode?

If my R code, which plots several graphs, is contained within one babel code block in org-mode, is it possible to export all of the graphs and display them in the #+RESULT section after evaluating the ...
2
votes
0answers
282 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
1answer
99 views

The correct way to declare common vars in babel

I'm playing with the idea of "literate devops" with org-mode. To simplify scripts i've extracted common values into :PROPERTIES: drawer, which looks like this: * Scripts ** Subscripts-A *** ...
6
votes
1answer
2k views

Org-babel 9 + Spacemacs: Unable to evaluate org-babel SRC Blocks

I followed every instruction I could here Org-mode 9: unable to eval code-blocks, and I am unable to get org-mode and org-babel to evaluate any code blocks in any language. I am dead in the water and ...
8
votes
1answer
480 views

Config, examples and use cases of Library Of Babel

I want to understand how org-babel's Library Of Babel works. Seems like a powerful yet underused tool. The documentation says that I can add code to the library, by first saving the code in ...
1
vote
1answer
410 views

org-babel-load-file doesn't load entire file

In ~/.emacs.d/init.el I'm calling my annotated configurations file settings.org like so: (require 'ob-tangle) (org-babel-load-file (expand-file-name "~/.emacs.d/settings.org")) This generates ...
0
votes
0answers
153 views

Tramp Ipython remote session: Problems with remote paths within code

Here's my setup: * Tramp on remote :PROPERTIES: :header-args: :dir /ssh:me@server.com|ssh:me@remote:/project/ :END: #+BEGIN_SRC ipython :session :results output drawer import pandas as pd data = pd....
1
vote
0answers
368 views

How to evaluate source code block on remote host?

I am working on windows machine. I have last org version (from February 2017). I have a remote host accessible by putty, where i have created org file of the following contents: #+TITLE C language ...
2
votes
1answer
355 views

Org Mode Babel - ensure more than one empty line between tangled code blocks (for python)

Suppose I have two code blocks in my org file #+BEGIN_SRC python :tangle ~/dummy.py class A: pass #+END_SRC #+BEGIN_SRC python :tangle ~/dummy.py class B: pass #+END_SRC After org-babel-...
0
votes
1answer
81 views

Define a new babel src (based in python)

I would like to write pieces of code (I don't need to evaluate it---yet---) of Cadabra see the web page which is based in python. However, it uses the symbol # as part of the code. How could I define ...
5
votes
1answer
198 views

Can I alias a language for org-babel SRC blocks?

I've got a new language I'm working on that I'm documenting in an Org file. Code samples for this language can be written in lisp-mode, but I want to use the new language's name for the SRC blocks ...
1
vote
0answers
202 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....
2
votes
0answers
99 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
2answers
428 views

Elisp code output style in org mode

I want to print elisp code result as original but currently it will output with "|" separated. for example: #+BEGIN_SRC emacs-lisp (setq my-list '(apple orange peach)) #+END_SRC The code block will ...
1
vote
0answers
304 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: #+...
3
votes
1answer
132 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
4answers
1k views

Clojure code evaluation in org-mode produces no output

I am trying to run clojure code from my org file in order to do some literate programming. What is not working: When I execute the source code block I get No output produced. Sample src code block ...
4
votes
1answer
375 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 :...
5
votes
1answer
294 views

In org-mode, can I include a horizontal separator in a result table generated by an Emacs Lisp code block?

I have some Emacs Lisp code blocks in an Org file which I evaluate to get tables of results. It would be nice if I could include horizontal separators to separate individual lines of data from ...
0
votes
2answers
231 views

How can I start a server in the background from a source code block without freezing emacs?

I am creating several org-mode documents to track code example and would like to be able to view the results of tangling or executing these code blocks in a browser. In the example below, I've created ...
4
votes
1answer
2k views

export R code results in org-mode?

I want to execute R code blocks in org-mode and export the results to a PDF/html. Here is an example: Some text here... #+begin_src R :results output latex library(xtable) x <- rnorm(100) y <...
1
vote
1answer
53 views

Org-babel variables argument reading twice

I am executing a src block on a table that is determined by a prompt. A minimal example: #+NAME: a-table | Value | #+begin_src emacs-lisp :var (princ (format "table=a-table" (read-string "Select: ")...
2
votes
1answer
167 views

Selectively Highlight lines in source code block

I use emacs org-mode and find feature of source code blocks extremely useful. However, If I want to say highlight a couple of lines in my source code block, is it possible to achieve? e.g. #+...
3
votes
2answers
506 views

Access and adjust global variable from org-mode as local buffer variable

I'm currently working with a lot of javascript in my org files. Therefore I introduce a local buffer variable that will automatically insert javascript as language identifier in my file whenever I ...
1
vote
1answer
377 views

Org-mode only export LaTex Source Blocks

I'm looking to use org-mode to typeset homework for a math class I'm taking and was wondering if there is a way to export only certain LaTex blocks to the final PDF using org-babel. As an example ...
1
vote
3answers
617 views

Outputting figure from R to LaTeX in source block with caption

I am trying to run a source code block and have the outputted figure go into a LaTeX document as a figure. Basically I am doing this in a way slightly similar to Jupyter notebooks, but with the ...
3
votes
0answers
182 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
1answer
1k views

C/C++ coding in Emacs org-mode's babel

I'm not finding a lot of examples/documentation for the non-REPL world of C/C++ in Emacs org-mode babel. For example, is there a way to break a program up into separate source code blocks, i.e., a ...
2
votes
2answers
952 views

Running :noexport: code on export

According to the org-mode manual (emphasis added by me): The tags that exclude a tree from export (org-export-exclude-tags). The default value is :noexport:. Entries with the :noexport: tag will be ...
2
votes
1answer
612 views

How to return an org mode table with headings and hline from Ruby

I have the same question as this question except that I don't see how to do so other than in elisp. I am using Ruby, but I suppose the question applies to other languages as well. If I return an ...
2
votes
0answers
604 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
1answer
195 views

Ignoring subtrees with a certain tag

I want to ignore a subtree temporarily. I can do this by setting the property :header-args: to :tangle no, but this is not usually visible. Could I have this property set automatically by all ...
1
vote
1answer
488 views

svg pictures from tikz in html export in windows

I want to create both PDF and HTML figures using Tikz for both purposes. I am doing as it is explained in here, answer of nberth. To do this, I installed imagemagick for windows because this solution ...
0
votes
1answer
86 views

Face of org-mode source block changes when returning from edit buffer

A strange thing happens when editing source blocks within an extra buffer with C-c ': the face of just this source block changes upon returning, i.e. the face settings are not used any more. I'm ...
1
vote
1answer
183 views

Ouput Of Org Src Block Is Squeezed Into A Table

I'm using org-mode + org-babel to execute Bash commands that execute Docker commands. Here's an example: #+BEGIN_SRC sh :exports both :dir ~/Dev/Docker/sample sudo docker build -t tompurl/nginx . #+...
1
vote
0answers
214 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 ...
4
votes
0answers
214 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 ...