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
4
votes
1answer
200 views

Is it possible to have shared #+PROPERTY: between multiple org files?

I'm working with org-mode and org-babel to query a PostgreSQL database. It's pretty cool setup and I love it. At the moment, I have multiple org files with the same database property configuration ...
1
vote
1answer
60 views

rewrite relative or absolute path from inherited tramp ssh property with org-babel

I define a global remote session for all my sh block code with properties :PROPERTIES :HEADER-ARGS:bash: :dir /ssh:xxx@myvm:/home/xxx/ :END: In my other bash blocks, I inherit this property, but ...
0
votes
0answers
9 views

Record command into bash source block using asciinema and org-babel

As you perhaps know, asciinema rec (asciinema rec path/to/file) and generate an asciicast file which contain all commands recorded on terminal. I think using asciinema to replay this file (asciinema ...
-1
votes
1answer
98 views

ob-async issue, seq-random-elt not defined

I would like to asynchronously run code blocks in org mode. My org mode version (org-version output) is: Org mode version 9.2.1 (9.2.1-23-g126a37-elpa @ /home/user/.emacs.d/elpa/org-9.2.2/) I ...
0
votes
1answer
15 views

“Run all code blocks above this point” in org-babel?

I know you can use org-babel-execute-src-block (C-c C-c) to execute individual code blocks, but is there something akin to "Run all chunks above" that RStudio has for Rmarkdown files?
0
votes
2answers
278 views

ledger in org-babel blocks uses incorrect path data in Windows 10

I am trying to include a ledger data file from an org-babel block. I am using Windows10 and the SciMax emacs distribution. #+begin_src ledger :cmdline bal :results output :exports results !include d:/...
0
votes
1answer
18 views

org-mode call python source within latex source block

I have a piece of python code that outputs latex code. I'm trying to call the python source block from within a latex source block so it will format the output as latex when I export. Any idea how ...
1
vote
0answers
25 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 ...
0
votes
1answer
20 views

Org entry found only from its own buffer [duplicate]

I tried to detangle (org-babel-detangle) a latex file and got the error message Cannot find entry with ID "......." with the ID of the subtree of the first block. But the entry does exist in the ...
15
votes
1answer
1k views

Is it possible to org-bable-tangle an org file from the command line?

I would like to manage the tangling my org files with a Makefile. Though I can not find any information of how to tangle files from the command line.
1
vote
1answer
33 views

Org-mode: use result from babel in another programming language

Org and babel in emacs are awesome. Is it possible to have something like this: Here is a C code #+BEGIN_SRC C :output results #include <stdio.h> int main(){ int x = 5.00; int i; ...
0
votes
1answer
15 views

org-mode capture click event within org-babel code block

I wish to run C-c C-c, then click any code line to trigger my code (print "clicked" in this demo) #+BEGIN_SRC elisp :results output (defun myclick(n) (interactive "p") (print "clicked") ) (add-...
0
votes
1answer
43 views

Managing path for reproductible scientific paper using session, org-babel and org-mode

I'm starting using org-mode and org-babel to support my day by day scientific work and produce reproductibles papers. Lot of people use rMarkdown/jupyter to do that, but i'm interested by investing ...
1
vote
1answer
52 views

Remove extra prompts in Emacs Babel Python session

When I run the following code block from Emacs org-babel: #+BEGIN_SRC python :session *Python* :results output print("Hello World") #+END_SRC This is what prints out in my *Python* session: >...
1
vote
1answer
35 views

Write text between inline exported code and the result of this execution code?

After some search, i don't found example corresponding to my use case. Writing a research text, i'm interested to mix source blocks code and text with results using inline mode, for example this ...
1
vote
1answer
70 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: : /|...
3
votes
1answer
32 views

No graphic output for MATLAB src block in org-mode

In an org file, if I include a MATLAB src block that has a graphic output (a figure is plotted there), for example, the following src block: #+begin_src matlab :session :file tst.png :results ...
0
votes
0answers
14 views

shell blocks chaining with :post-processing calls and using stdin to create “filter” blocks

To increase modularisation of my emacs code blocks I'm attempting to factor out common functionality into separate function blocks. I'm running into difficulties with chaining :post calls, and using :...
1
vote
1answer
13 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
1answer
128 views

Cannot add general block header arguments in org mode

While I'm learning javascript following a book, I Like to take notes with org-mode. I use Indium and followed this instructions to handle it working It works well, and I get my work done, interacting ...
3
votes
1answer
140 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-...
6
votes
3answers
1k views

Is it possible to enable minor modes in org babel blocks?

I use org-edit-special and it's really convenient, when editing source code, that's stored in org files. However I often only want to copy some code and I'm used to the highlighting of highlight-...
1
vote
1answer
98 views

org-mode: How can noweb handle a multiple line output

I have a code chunk in my document that I want to use as a list of patterns to search for with grep. If I were just writing a script without org-babel, I could write. a="ar er ir or ur" printf "...
1
vote
1answer
31 views

Remove the suffix `^M` when run ls in org src

When run ls to print the file list #+begin_src ipython :session sql :results output ! ls | head -n 5 #+end_src #+RESULTS: : create.txt^M : Lesson 10. Grouping Data.md^M : Lesson 11. Working with ...
1
vote
1answer
23 views

org-babel - Use specific python path and command line option

Since different python version installed on my system, how can I use specific python and option to run it? For example,below test.py file will print hello output. #!/opt/anaconda3/bin/python --...
0
votes
1answer
297 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 ...
1
vote
1answer
14 views

Python src block sets tabs

Emacs 26.3, Org 9.3 When using python src block, it changes 8 spaces to tab. When tangling this, python errors with "inconsistent use of tabs and spaces in indentation". How fix it?
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 ...
0
votes
0answers
8 views

Removing extra blank lines in R output

I noticed than when writing a multiline src code block in Org-mode, and if only the final command line produces an output, the R output includes an extra blank line at the top, like here: #+begin_src ...
0
votes
1answer
48 views

How to disable code blocks in an Emacs org-mode init file

My dot emacs config consists of a short init.el file and a very large org file in which I have created dozens of emacs-lisp code-blocks. This works very well for me, especially in terms of ...
0
votes
2answers
446 views

Cannot Execute Org-Babel Haskell Block

In an org-mode file: #+BEGIN_SRC haskell let x = "test" putStrLn x #+END_SRC yields: executing Haskell code block... if: ‘org-babel-script-escape’ expects a string
0
votes
0answers
27 views

Export comments and babel src results to markdown

When I export to another format like rst from org, the comments #comments and the results from babel src will not be exported. How could I include them to export?
2
votes
1answer
144 views

Efficient workflow to write a book in Org-mode

I plan to write a short statistics textbook using Org-mode. Even if some textbooks have been written using equivalent systems (e.g., the R package bookdown), I have no examples in mind of books ...
3
votes
1answer
143 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 ...
5
votes
1answer
48 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=...
1
vote
1answer
51 views

No org-babel-execute function for js!

I'm using org-mode in Spacemacs and have this code block: #+BEGIN_SRC js :var payload=access-token-payload let parsedPayload = JSON.parse(access-token-payload); return parsedPayload.access_token; #+...
2
votes
2answers
51 views

Insert Org or Markdown code blocks with Babel in org-mode?

In org-mode, if I do something like this: #+begin_src org ## What does this PR do? - Updates the Dockerfile to make the `dev` service connect to a shared network at startup - Registers the `...
0
votes
1answer
350 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
3answers
163 views

Babel + Python function definition with for loop causes IndentationError

I am using orgmode and Babel to run Python source code blocks. I noticed that if I define a function that returns a value, and if this function has a for loop inside it, then evaluating it with Babel ...
0
votes
0answers
23 views

Force org-babel-load-file to execute every time emacs is loaded

I have this code in the init.el file: (org-babel-load-file (expand-file-name "myinit.org" user-emacs-directory)) Which used to generate a myinit.el file every time I start emacs. I would ...
7
votes
4answers
4k views

Setting up Ditaa in Org-mode

I've been having trouble setting up ditaa to work in emacs, I got my copy of the ditaa jar from here And I've been trying to run this code block #+begin_src ditaa :file hello.png :exports results ...
1
vote
1answer
63 views

how to speed up org-babel-tangle?

I have an org file of 470 lines, 20 headings and 15 noweb references. From it I tangle 2 files that are 250 lines and differ very little. Tangling takes over a minute and a lot of painful redisplay: ...
0
votes
1answer
22 views

org mode babel use contents of block as file in another block

I'm trying to define some data in json file and use the file name in another bloc as command parameter. Something like that: The data: #+BEGIN_SRC json { "Foo": "Bar" } #+END_SRC ... and the ...
1
vote
1answer
54 views

Best way to make orgmode source code blocks aware of my $PATH and other environment variables?

By default my source code block can't find most executables: #+BEGIN_SRC bash which aws #+END_SRC #+RESULTS: This fixes the problem: #+BEGIN_SRC bash source $HOME/.bash_profile which aws #+END_SRC ...
-1
votes
1answer
29 views

Can “kaz-yos/eval-in-repl” use the prexisting “inf-ruby” console started by robe mode

I've been using org babel to execute ruby code, works well but wrapping blocks with begin_src/end_src is cumbersome no live output - i have to wait till the whole process finishes to see output ...
0
votes
1answer
33 views

Disable indenting on org-babel restclient edits

Despite I am not a new Emacs user, my elisp is nearly not existent. I want to present some REST API stuff with epresent and org babel restclient. This is working fine until I want to edit a source ...
0
votes
1answer
32 views

Retrieve the lunar phases to diary.org as a record

I tried to record the sunrise and sunset info to the diary #+begin_src emacs-lisp :tangle yes (sunrise-sunset) ;;(lunar-phases) #+end_src #+RESULTS: : Sunrise 6:57am (CST), sunset 5:00pm (CST) at ...
5
votes
2answers
1k views

How can I customize the LaTeX export of org babel #+RESULTS?

I regularly use org-mode and org-babel to create e.g. exercises or proof-of-principle documents which I export to PDF via the LaTeX exporter. I noticed that the #RESULTS generated by a #+begin_src-#+...
0
votes
0answers
19 views

Redirect mysql complete ouput to results

I tried sql source code in org mode #+begin_src sql :engine mysql :dbuser org :database grocer select prod_id, prod_name, prod_price from Products; #+end_src #+RESULTS: | prod_id | prod_name ...
0
votes
0answers
61 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 :...