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 Org-babel is now incorporated into Org-mode as 'working with source code' and no longer a separate extension.

232 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2 votes
0 answers
55 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 ...
Daniel's user avatar
  • 3,653
2 votes
0 answers
122 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 ...
Alex's user avatar
  • 1,038
2 votes
0 answers
422 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 ...
sooheon's user avatar
  • 481
2 votes
0 answers
257 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 ...
Emacs User's user avatar
  • 5,643
2 votes
0 answers
407 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 ...
Gambo's user avatar
  • 929
1 vote
0 answers
27 views

org-babel :results header-arg, graphics vs file

The org manual describes how to evaluate a src block and capture the results, using :results <collection> <type> <format> <handling> # i prefer to use this terminology for the ...
user615536's user avatar
1 vote
1 answer
25 views

Org babel javascript using incorrect path names

I am trying to run javascript code blocks in Org Babel. My system is Cygwin on Windows 10 with Cygwin emacs-w32. (Beautiful setup in general, I love it. Makes Windows Unix-like and bearable to me. ...
Edward Doolittle's user avatar
1 vote
0 answers
39 views

‘:colnames yes’ not working?

I tried the example from (info "(org) Environment of a Code Block"): #+NAME: less-cols | a | |---| | b | | c | # I changed the value of ‘:colnames’ to _yes_. #+BEGIN_SRC python :var tab=...
shynur's user avatar
  • 5,288
1 vote
0 answers
113 views

org-mode latex export of source block with engraved gives error for latex3 code due to missing color-`face` processing

I want to export my source blocks from org-mode to pdf through latex with the export backend engraved. I installed the package engraved-faces, set the variable with (setq org-latex-src-block-backend '...
lukeflo's user avatar
  • 195
1 vote
0 answers
35 views

Can :var NAME=ASSIGN in org mode work if ASSIGN includes a colon?

I use org-ref in org-mode to handle cross references, and I use labels like tab:one, fig:two, etc., to identify label types and format them accordingly (using cleveref in LaTeX export). I then have ...
Stefano's user avatar
  • 141
1 vote
0 answers
27 views

How to remove results drawer from emacs jupyter?

I am using emacs-jupyter (commit - 16cbda79167b4e2f2c6b61b218658f0f660d97f9 [otherwise I get an error]) on emacs-29.1 and org-9.7pre. My default header arguments are... org-babel-default-header-args:...
user41177's user avatar
  • 121
1 vote
0 answers
72 views

How To Tangle Org Src Code Block Under Conditions

I'm using .org files to keep track of my system configuration across different machines and I want certain code blocks to be tangled only if certain conditions are met. Let's say I have something like ...
thanosapollo's user avatar
1 vote
0 answers
78 views

org-mode show image inline from remote server

I would like to execute a dot command from remote server, then show the output png image in my org-mode. * remote dot demo #+NAME:dotsrc #+begin_example digraph RecordShapedNodes { rankdir="...
lucky1928's user avatar
  • 1,666
1 vote
0 answers
38 views

Determine org babel session name specified with header-args property

Is it possible to get org babel source block's associated session name when the session name is specified with the header-args property of a file or a heading. (org-babel-get-src-block-info) returns ...
Arktik's user avatar
  • 972
1 vote
0 answers
17 views

How can I handle an emacs org-babel snippet triggering emacsclient

I want to call an external tool which will eventually invoke $EDITOR to do its thing. However from inside an org-babel code block this fails because while executing the code block the emacs I'm ...
stsquad's user avatar
  • 4,661
1 vote
0 answers
60 views

org-babel syntax highlighting with one language, executing with another

I'd like to set a #+begin_src ... #+end_src block so that it highlights syntax with one language, while org-babel-execute executes with another language. Namely: I work with metapost code within a ...
Massimo2013's user avatar
1 vote
0 answers
51 views

Org Mode: Produce Result Block when indirectly calling src block as dependency

Consider the following org mode document: #+NAME: source #+BEGIN_SRC python :cache yes import random return random.randint(3, 300) #+END_SRC #+RESULTS[2314024a531aeb3c9e51cd69e45adf654927e9fa]: ...
Keozon's user avatar
  • 111
1 vote
1 answer
157 views

No comment syntax defined when tangling lua or vimrc code blocks

Resolution With help from commenters, I have things kind of working. I removed :comments link from Properties. I manually added comments to the top of every code block to replicate what :comments ...
Jason's user avatar
  • 111
1 vote
0 answers
574 views

Lsp-mode on org-mode babel

In my quest to find ways of making emacs more snappy, I installed lsp-mode. The main language I work with is R, and indeed using lsp-mode in .R files is much quicker than the ess built-in completion. ...
lf_araujo's user avatar
  • 123
1 vote
0 answers
193 views

org-babel how to run d3.js code in code block

Anyone can help direct me about how to run d3.js code to draw graph in org-babel code block? d3.js is a javascript library but it need to output svg to html body. I saw markdown language support it ...
beetlej's user avatar
  • 1,100
1 vote
0 answers
265 views

How can I generate images from LaTeX without using ghostscript/ImageMagick?

My question here is about generating images from LaTeX source blocks in .org files The following source block (edited down to a simple use case) works fine and produces a .pdf, but this does not ...
nonreligious's user avatar
1 vote
0 answers
75 views

How to setup the structure of org mode with a known html file?

I want to create an Org file, then export to HTML such that the final site looks something like this: https://html5up.net/dimension. If you go to their index.html file, their structure in HTML looks ...
mle0312's user avatar
  • 295
1 vote
1 answer
451 views

(Org) TikZ for exporting both LaTeX and HTML/MathJax

I'm exporting an Org Mode project both to LaTeX and to HTML (with MatJax). Now I need to add a TikZ picture which can be exported nativelly on LaTeX and must be rendered in svg for HTML. Writing the ...
DPD-'s user avatar
  • 251
1 vote
0 answers
87 views

Direct inclusion of resulting link file during export in Org mode

I'm preparing static html site with interactive Javascript components visualizing my research data in Org mode. Javascript components are returned by the Org Babel Python script in form of HTML string ...
premopie's user avatar
  • 378
1 vote
0 answers
127 views

How to output orgmode julia DataFrame as orgtbl?

In the following link, we see that we can use a table package in Python to return in orgtbl format. #+begin_src python :results value raw :output :return tabulate(df, headers=df.columns, tablefmt='...
BuddhiLW's user avatar
  • 297
1 vote
0 answers
47 views

Why does babel insert whitespace after parentheses in :var values?

I am running GNU Emacs 27.2 (build 1, x86_64-w64-mingw32) of 2021-03-26 on Windows 10 with org-mode 8.3.4-102-gebe7aa-elpa. When I #+CALL a code block passing in a var with a parenthesis, a space ...
Matt Innes's user avatar
1 vote
0 answers
37 views

Supplying stdin input as a source block for CPP code as in shell script

I am trying to supply code with stdin via a named example block using org-babel, as below (with help): #+NAME: read-to-stdin #+begin_example Hello, World! #+end_example The shell block #+name: shell-...
alex elias's user avatar
1 vote
1 answer
269 views

Why is electric-indent-mode adding extra indentation after pressing return twice in org source blocks?

When I try to write code in source block in Org mode, pressing return once acts as expected while hitting it a second time increases the indentation to two levels if it's currently less than that. ...
Ivanna's user avatar
  • 111
1 vote
0 answers
495 views

Trying to run Scheme in org mode

I installed geiser, set my default scheme to guile, and enabled scheme support but I can't seem to get it to work. I am getting this output and am not sure what to make of it. #+begin_src scheme :...
Doomer1999's user avatar
1 vote
0 answers
26 views

How to not include newlines in strip-export

I'm using the following snippet #+NAME: save-file #+BEGIN_SRC python :results silent :var filename="filename" plt="plt" :exports none return f"\nfname = 'assets/' + filename + ...
FieryCod's user avatar
  • 167
1 vote
0 answers
225 views

orgmode - adjust tikz picture width for beamer output

In this example, the first column width adjust works but the second column doesn't. * topic ** column1 - first - second :PROPERTIES: :BEAMER_col: 0.5 :BEAMER_env: block :END: #+ATTR_LATEX: :...
lucky1928's user avatar
  • 1,666
1 vote
0 answers
172 views

Customize org-babel latex template when evaluating a source block

I'm using latex source blocks to generate images with org-babel using :results file as in the example below #+begin_src latex :results file graphics :file myplot.pdf :fit yes \LaTeX #+end_src When ...
darcamo's user avatar
  • 311
1 vote
0 answers
39 views

How to replace sections of non-org files from within org-mode?

I am trying to write some notes on django with the help of org babel. Is there a way to replace a block in a file(which was not tangled with org) after I eval a certain src block? Here's what I mean: ...
Sarthak Adhikari's user avatar
1 vote
0 answers
73 views

Exporting JPG image from LaTeX SRC-block with :async header

I like to generate JPG images from my LaTeX/tikz drawings in my org files. For this, I use constructs like #+NAME: my image #+HEADER: :file my-image.jpg #+BEGIN_SRC latex :results file raw :...
vdegner's user avatar
  • 25
1 vote
0 answers
225 views

org-babel: zsh sessions use bash

#+BEGIN_SRC zsh :session z1 echo $HOME $0 #+END_SRC #+RESULTS: : /Users/evar /bin/bash I am thinking of trying the workaround outlined here, but shouldn't this work out of the box? Update: I couldn'...
HappyFace's user avatar
  • 830
1 vote
0 answers
132 views

How to not display environment variable in org-babel src block?

I want the effect of this: #+BEGIN_SRC shell :dir src CC=gcc-9 make #+END_SRC But I don't want CC=gcc-9 to show up in the output. Is there a way to somehow include the environment variable in the ...
Alex Shroyer's user avatar
1 vote
0 answers
49 views

Org source block for Octave session fails with large matrices

Sometimes I have to analyze quite large matrices with octave as part of a documented reproducible work. Org files with Octave source blocks are the ideal format for that purpose. One defines the ...
Tobias's user avatar
  • 33.2k
1 vote
0 answers
54 views

Modifying syntax so as to grey out the non-source part of an org file

I thought a nice alternative to (org-edit-special) (which becomes cumbersome with many small blocks), and to tangling-and-untangling (which is incompatible with noweb references), might be simply to ...
Toothrot's user avatar
  • 3,264
1 vote
0 answers
43 views

org-babel python :session names matter

For example, I get #+BEGIN_SRC python :session sdfjkl :results output import numpy #+END_SRC #+RESULTS: : Python 3.8.0 (default, Oct 23 2019, 18:51:26) : [GCC 9.2.0] on linux : Type "help", "...
extremeaxe5's user avatar
1 vote
0 answers
33 views

Multiple insert point org source code insert

I know that we can customize the source code expansion <s TAB using something like this (add-to-list 'org-structure-template-alist '("s" "#+BEGIN_SRC ? :results raw replace drawer ...
mle0312's user avatar
  • 295
1 vote
0 answers
52 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 ...
kshenoy's user avatar
  • 211
1 vote
0 answers
386 views

Org-mode results verbatim not working for Scheme code

I have the following source block of Scheme code: #+BEGIN_SRC scheme :results value verbatim append (define shift (lambda (list-with-sublists) (cond [(pair? (car list-with-sublists)) ...
Zelphir Kaltstahl's user avatar
1 vote
0 answers
21 views

Highlighting the currently active org-Babel block

I want to do something similar to hl-line-mode but not sure if it has been implemented already and how it can be implemented. The goal would be to set two color schemes for the #+begin and #+end ...
Quarky Quanta's user avatar
1 vote
0 answers
45 views

Spaces get trimmed when I use org table in (R) code block

Please, help! I use literate programming and I want to use org-mode tables as data for my R code blocks. However, when it comes to cell values that have meaningful leading and trading spaces org-mode ...
Stas's user avatar
  • 301
1 vote
0 answers
62 views

tide-mode in org-edit-src-code

I want to activate tide-mode when using Javascript soruce code blocks, following this it works well with indium: https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-js.html But I want to use ...
anquegi's user avatar
  • 749
1 vote
0 answers
165 views

org-mode: Use dvisvgm on HTML export of Babel LaTeX blocks

As far as I understand, there are two competing forces when exporting LaTeX to HTML. If it's in the text (including using \begin blocks), then the preview mode of org.el is used, relying on org-...
Michaël's user avatar
  • 334
1 vote
0 answers
71 views

Leave noweb references in Org-Babel unevaluated with variables

I'm currently getting into Literate Programming with org-mode in Emacs. One of the key features to make it tractable as a programming style is macros. I would like to be able to do something like this:...
Suskeyhose's user avatar
1 vote
0 answers
50 views

Use result of ob-shell block in subsequent ob-shell block

#+BEGIN_SRC sh aws ec2 describe-instances #+END_SRC #+RESULTS: i-0154b911d1f4e0871 #+BEGIN_SRC sh aws ec2 terminate-instances "param1" #+END_SRC How can I use the result of the first block as the ...
american-ninja-warrior's user avatar
1 vote
3 answers
453 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 ...
Guilherme Salomé's user avatar
1 vote
0 answers
60 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 ...
AndyJ's user avatar
  • 359