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.

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 ...
9
votes
1answer
333 views

Edit multiple occurences of the same tangled file in one buffer

I've got multiple source blocks which are all tangled to the same file. When I invoke C-c ' inside one block, only this specific block is shown in a new buffer. Is there a possibility to show all ...
22
votes
3answers
851 views

Smooth (mouse) scroll for inline images?

I display images in-line with begin_src & result blocks. However, for large-images, when I scroll past the bottom of the image, I get a 'jerk' and the whole image is scrolled away. Similarly if I ...
2
votes
1answer
119 views

Problem with add-to-list in babel src block

When I execute a babel src block with add-to-list function like this: #+begin_src emacs-lisp (add-to-list 'org-src-lang-modes (quote ("plantuml" . fundamental))) #+end_src I will get this error ...
5
votes
1answer
188 views

Support to refactor/convert source into literate programming with org-mode/babel?

I'm thinking of using literate programming to investigate large amount, or hard to understand source code. For the purpose, I'd like refactor the source code into literate programming text with org-...
6
votes
1answer
858 views

How to allow org-babel to play with python virtual environment?

I have virtual environment set on my system (actually virtualenvwrapper). I would like to direct org babel to use a specific environment in a single code block or on the whole buffer. How can I do it?
0
votes
1answer
247 views

Can org-babel 'result' not insert a newline at the end?

When I run a snippet of code (C-c C-c) (e.g. for making a PlantUML diagram), there is a trailing new line in the results, e.g.: #+BEGIN_SRC plantuml file hello.png ... #+END_SRC #+results [[img] &...
7
votes
1answer
2k views

Execute src block on org mode export

I have some sort of fundamental confusion about using src blocks in org mode. I define a custom latex class in an emacs-lisp src block at the top of my org file. Export fails however, unless I ...
3
votes
1answer
130 views

clockreport, total productivity by day?

With clock reports, one can set :step day, and then I have a list of totals by day. Like: #+BEGIN: clocktable :tstart "<-1w>" :tend "<+1d>" :step day :scope ("dev.org" "tst.org") :...
1
vote
1answer
581 views

Exporting the results of code evaluation in org-babel by default

I have these settings for evaluating emacs lisp code in babel: ELISP> org-babel-default-header-args:emacs-lisp ((:eval . "never-export") (:exports . "both") (:hlines . "yes") (:colnames . "no"))...
10
votes
1answer
481 views

Set default language for code-blocks in orgmode

Is there a way to define a default language for org-mode code blocks in the docuement header? Usually, within one org document, I only use one programming language, so it's getting tiresome to always ...
3
votes
1answer
409 views

org-mode: have flycheck resolve relative config while editing code blocks

Desired behaviour While editing code blocks with org-mode by pressing C-c ' I'd like Flycheck to resolve relevant configuration the same way it does for normal files. I'm using JavaScript, and these ...
3
votes
1answer
243 views

Export results of codeblock, then later export the source block (e.g. as for a code-listing in a document appendix)

I have a document in which I have named R source code blocks. These blocks are set to export the results only in the text narrative. However, I would like to include the code for these blocks in an ...
13
votes
1answer
396 views

Generating output in a different language with org mode

Given the following is intended to generate C++ code: #+BEGIN_SRC python :exports both :results output code print "struct Whatever{};" #+END_SRC The result is inserted as follows: #+RESULTS: #+...
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 ...
7
votes
2answers
1k views

Can org-babel replace code with code output on html export?

I'm using org-mode to generate web pages of my notes. Can I embed code to generate additional HTML, etc? org-babel will generate results but it seems to show the results in addition to the code. I ...
4
votes
1answer
2k views

Variables in Babel evaluation with SQL blocks

According to the org-mode manual, you can set variables in code blocks as follows: #+HEADERS: :var foo="blah" #+BEGIN_SRC elisp (message foo) #+END_SRC #+RESULTS: : blah However, when I try to do ...
2
votes
2answers
313 views

Is there a variable with a list of languages supported by Org-mode src-blocks?

In org-mode, is there a variable/const/whatever containing a list of all languages supported in "BEGIN/END_SRC" blocks? Are there any other methods to list them? (except parsing a list of ob-*.el ...
6
votes
1answer
2k views

Centered figures in org-mode LaTeX export

When org-mode exports figures to LaTeX, the figure shows up left justified. Is there an easy way to have all the figures centered? I want to avoid having to type #+ATTR_LATEX: :float t above each ...
8
votes
1answer
998 views

How to force an org-babel session to reset or initialize?

If I run the following babel shell blocks #+BEGIN_SRC sh :session one :results output ssh staging #+END_SRC #+BEGIN_SRC sh :session one :results output hostname #+END_SRC Org creates a shell ...
0
votes
1answer
403 views

*Org Src file.org[ R ]*: C-c ' is undefined

I'm trying to edit a code snippet in org-mode. When I type C-c ' in org mode buffer, it opens up the editor window in R-mode, but it doesn't know about C-c ' and cannot be killed by C-x k since when I ...
7
votes
1answer
691 views

working setup for ipython in babel

Can someone point me to a working setup for using babel with IPython? I'm witnessing strange indentation behavior when I try to define functions. This happens whether or not I specify the --classic ...
5
votes
1answer
1k views

Org code block receives table without header

I'm trying to send an Org table as a lisp object to a code block for further processing with an elisp function. For testing I set up two code blocks, one that generates the table and another that ...
16
votes
1answer
2k views

How to specify default header arguments in orgmode code blocks

I'm tying to set default header arguments to the code blocks within my org file, like this: #+PROPERTY: header-args :session *my_python_session* #+PROPERTY: header-args :results silent #+PROPERTY: ...
0
votes
1answer
150 views

How to bash command output that isn't STDOUT from babel shell command

Is this possible? For example, determining the version of anaconda: #+BEGIN_SRC sh :results output conda -V | grep "conda" #+END_SRC If I remove the grep part I get no output at all, with it I at ...
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
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 ...
4
votes
1answer
1k views

live refresh of inline images with org-display-inline-images

Recently I've noticed the function I had been using to do refresh had stopped working and I had to change to a simpler call. I used to have: (defun k/org-babel-refresh-inline-images () (org-...
47
votes
5answers
10k views

Can I use org-mode to structure my .emacs or other .el configuration file?

My .emacs configuration file gets bigger and bigger and I'd like to get a better overview and structuring by adding headings, subheadings and being able to hide or show them like I can do with Emacs ...
4
votes
2answers
418 views

apostrophe in org-babel export to latex and beamer

How can I get org-babel to properly render ' and not ’ when exporting to LaTeX and to Beamer? I didn't find any good solution yet, and I would like the code to be copy-pasteable.
4
votes
2answers
356 views

Greek characters in graphs produced by org-babel and gnuplot

I can generate plots using gnuplot source blocks with org-babel like the following: #+begin_src gnuplot :file plot.png plot x w l t "$\epsilon$ = 1", \ 1-x w l t "ε = 0.1" #+end_src which ...
8
votes
1answer
1k views

Display errors and warnings in an org-mode code block

I would like to be able to report warnings and errors when evaluating a Python code block in an Org file. When a code block has Python syntax errors, Org helpfully pops them up in a separate ...
11
votes
2answers
2k views

Can I include a common code block in two different code blocks in Org mode?

I have an org-mode file containing a table of data and two Python code blocks to extract different summaries from it. I would like to share some common constants and functions between these two code ...
3
votes
2answers
2k views

org babel eval with no confirmation is explicit: :eval yes

According to fniessen's babel reference I should be able to set :eval yes on a babel header line to make a source block evaluate without confirmation. However, this doesn't seem to work for me on ...
2
votes
1answer
461 views

Calling the calc stack from babel: displaying percentages

Calc supports displaying results as percentages with c %. How can I make babel return this? I tried: #+BEGIN_SRC calc 1 2 '/ 'c% #+END_SRC But this just gives an error. I also tried with a space ...
1
vote
1answer
305 views

Babel doesn't wrap results in verbatim

Here's an example: #+NAME: sys5 #+HEADER: :exports both #+BEGIN_SRC maxima :results raw programmode: false; solution: triangularize(coefmatrix( [ -3*x - 11*y + 7*z = 0, ...
5
votes
2answers
329 views

Controlling the order of output with Org-Babel

Consider the following Org file: #+PROPERTY: tangle "init.el" #+PROPERTY: noweb yes * A #+begin_src elisp ; initialization code ; this *must* come first #+end_src * B #+begin_src emacs-lisp <<...
4
votes
2answers
1k views

Referring to the org-babel src block name from within the script

This is tangentially related to my previous question on dealing with asynchronous babel scripts. Currently I have to manually specify the name of the src block the babel function is in: #+name: elisp-...
7
votes
1answer
562 views

Returning org-babel results from an asynchronous call

I'm currently experimenting with moving more of my development workflow into org-mode so I can keep better track of what testing I've done. However some of the steps involve asynchronous calls to RPC ...
10
votes
3answers
2k views

Code-block specific interpreter in Org Babel

Is it possible to have, in the same org file, two code blocks in the same language that are run in different interpreters by specifying different options at the top of the code block?
15
votes
1answer
2k views

Using Org Babel to tangle to a variable file name

If I have a code snippet that I tangle to a file, but I expect the file name to change over time, Is there a cleaner way to change the filename than Query-replace? For example, say I tangle code to ~/...
6
votes
1answer
342 views

Applying major-mode font locking to exported org-babel snippets

Currently I have a bunch of code snippets in my Org-based presentation. I'm exporting them with ox-reveal, but the exported code doesn't have any syntax highlighting. Is there any way to: have syntax ...
3
votes
1answer
358 views

Adding table headings to #+RESULTS: tables

I'm using org-babel to generate a result I want to export in my table. However I can't find a way to easily control the heading of the table. At the moment the best I can manage is echo'ing some CSV ...
6
votes
1answer
324 views

Finding and executing org-babel snippets programatically

I currently I have a couple of org-babel shell snippets to package up a build and push it to a server for later usage. This also handily keeps a reference to the last execution of the snippet so I can ...