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.

Filter by
Sorted by
Tagged with
0
votes
0answers
6 views

olivetti mode with polymode?

I am using olivetti-mode with org-mode, but the screen does not stay fixed to the same width when my cursor moves from the org text to code between #+begin_src ... #+end_src. Is there a simple fix ...
0
votes
0answers
16 views

Session support in org mode babel

I am trying to set up org-mode babel to work with MAGMA. What I have so far is very simple but works well enough. The problem is that it does not support sessions, which would be quite important to ...
3
votes
1answer
41 views

Org mode python code block with session does not return a result

I had been successfully using python code blocks with the :session header argument when I noticed that upon export no result was given. I then simplified my example to the following two: #+...
0
votes
0answers
31 views

(org-babel-load-file (expand-file-name “~/.emacs.d/config.org”)) behaves strangely on Windows 7

In my initialization file the line (when (file-readable-p "~/.emacs.d/config.org") (org-babel-load-file (expand-file-name "~/.emacs.d/config.org"))) give me the error: *Warning (...
1
vote
1answer
45 views

Why can't I use rg (ripgrep) in an Org mode source block?

I have the following source block in my Org mode file: #+begin_src sh :results output exec 2>&1 mkdir -p /tmp/example && cd /tmp/example echo "hello" > world rg --...
0
votes
0answers
48 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 :...
1
vote
1answer
53 views

org-mode source block: conditional header

How can I modify the header of a source block dynamically, based on the backend used to export my org-mode document? Specifically, I want the header to include :results output html when the file is ...
0
votes
0answers
26 views

Evaluate JavaScript source block in org-mode

If I attempt to evaluate a JavaScript source block then I have to return a value to get a result. For example: #+begin_src js return 1 + 2; #+end_src #+RESULTS: : 3 That's a bit unusual. I guess ...
0
votes
0answers
9 views

How to output the tangle property as comment as in org babel?

Tangling this: #+begin_src sh :tangle /home/user/foo.txt echo hi #+end_src Should become this: $ cat foo.txt #/home/user/foo.txt echo hi Can I maybe lisp evaluate the org babel :comment e.g. (...
0
votes
0answers
28 views

How to get JSON response only from an ob-restclient block

I'm trying to construct an Org-based pipeline for some DevOps activities. Part of this requires making REST API calls and proceeding based on the results of those calls. I'm using ob-restclient for ...
0
votes
0answers
30 views

`org-sbe` in block A cannot find block B defined in the same file if A is called externally

Calling uutil.org:summarize-files() in the other file prj_sum.org triggers (error "Reference ‘list-files’ not found in this buffer"), even though both summarize-files and list-files reside ...
0
votes
0answers
30 views

Skip noweb reference at export when org-export-babel-evaluate is set to nil

I have an org-mode document with many code blocks that I do not want to be evaluated at each export so I set the org-export-babel-evaluate to nil to avoid these evaluations which works as expected. ...
0
votes
0answers
23 views

How to Implement Column Wrap in org-mode Tables Programmatically

Note: This question is not well suited for standard emacs StackExchange format but I believe the discourse and exchange of techniques would be valuable for the community because the wrapping cells ...
0
votes
1answer
19 views

Org-babel: Notify if the result of execution differs from the previous recorded result

I want to use my org-mode documentation as a sort of quasi-unittest; I want to execute the whole buffer, and be notified if marked cells' new results differ from their previous results. E.g, #+...
0
votes
0answers
14 views

Using web-mode “localized” in babel

I am using org-mode babel to take notes. I am using source code blocks to write down examples of html interspersed with javascript. I take the notes in a subtree within a pretty big document. Now, ...
0
votes
0answers
24 views

Evaluate shell source block on spacemacs

I'm new to spacemacs. I did a fresh install following these instructions. When i try to evaluate a shell src block, i get the following message: org-babel-execute-src-block: No org-babel-execute ...
0
votes
0answers
13 views

Is it possible to use org-babel for periodic automated calls?

Is it possible to have an org-babel snippet that calls itself periodically e.g. every second and updates its RESULTS output? #+BEGIN_SRC emacs-lisp (current-time-string) #+END_SRC The following ...
0
votes
1answer
25 views

org-babel SQL How to use SELECT result single result without data cleanup?

I have quite a few SQL org-babel functions for fetching various(single record) IDs from the database. The snippet below works, but is there any way to skip that middle function that converts SQL ...
0
votes
1answer
26 views

orgmode - latex new line in tikz node not work

Below code works fine if copy the tikzpicture to tex file. but in orgmode, looks like the new line not take effect! #+header: :imagemagick yes :iminoptions -density 300 -opaque white -flatten -...
0
votes
1answer
35 views

Org mode exam template with question and results in combination with latex

I would like to use Org mode for creating exam questions and including the templates for the corresponding results for each question. A general template is shown here #+TITLE: Lecture #+AUTHOR: ...
1
vote
3answers
125 views

orgmode - do not export example block

I try to use a example block as input to babel block, I want to export babel results only, in below example, I try to add exports none to example block but it doesn't work, the example content ...
1
vote
1answer
18 views

How do I get org-mode to treat the output of a non-latex code block as latex?

(Emacs: v27.1, Org: v9.5, pdfTeX: v3.14159265-2.6-1.40.21) I am using the following Python code block to print LaTeX code: #+BEGIN_SRC python :session :exports both :results output :wrap math ... #+...
2
votes
0answers
81 views

Noweb references in sh blocks breaks the syntax highlighting

I use noweb references inside sh code blocks, for example: #+begin_src sh echo "test" <<some-ref>> echo "test" #+end_src But this causes syntax highlighting to ...
2
votes
1answer
44 views

Org-mode: disable abbrev-mode in source blocks

I use org-mode to write an executable paper, combining text and code. I make use of abbrev-mode to insert text more efficiently (e.g. type 'bc' to insert 'because') and to correct spelling errors. Is ...
0
votes
0answers
14 views

Dependent state in org-babel :var arguments

I enjoy using org-babel for testing/exploring API HTTP endpoints. #+BEGIN_SRC http :var access-token=select-access-token-from-sql :pretty GET http://localhost:3000/api/items/71 Authorization: Bearer ${...
0
votes
0answers
25 views

How to turn the result returned by `org-sbe an-src-block` into list (of lists)?

In MWE.org, the source blocks list-files, summarize-files-1, and summarize-files-2 are defined to summarize files. The list-files source block gives the filenames. The summarize-files-1 and the ...
0
votes
2answers
62 views

Org Mode evaluate diff code block

I'm writing a programming tutorial. In between the prose I have diff code blocks that show exactly what changes are done to the code on each step. To make sure the diffs are correct I'd like to be ...
0
votes
0answers
13 views

Pass a table's colnames to an R block

I have an org file with this content: #+name: my-table | *Type* | *Value* | |---------+---------| | Web | 744 | | Checks | 520 | | Cash | 105 | |---------+---------| | *Total* | ...
0
votes
1answer
36 views

org-mode org-babel share a global variable across the file

I'm a beginner org-mode user. Is there a way to remove baseUrl being duplicated in each block like the following one? #+NAME: request-something #+HEADER: :var baseUrl="http://localhost:3000" ...
2
votes
0answers
120 views

Emphasize text snippets in source blocks

If one sets org-src-fontify-natively to t org source blocks are fontified according to the associated major-mode. That is fine. But, is it possible to emphasize text snippets within the source blocks, ...
1
vote
1answer
43 views

How to remove indent on left margin and vertical line from src block when exporting org-mode to ascii?

When I export an org file to an ascii file, using org-export-to-ascii, I get some annoying lines on the left margin and an indent ,---- | .class{ | background:red; | } This is what I'm after: ....
0
votes
0answers
13 views

Get rid of “> > > > > > bash-5.1$” prefix in the results of a org babel code block

Anytime I execute a code block with C-c it contains the following prefixed results: #+RESULTS: #+begin_example > > > > > > bash-5.1$ <result-output> #+end_example This is the ...
0
votes
2answers
27 views

Org Babel execute bash via ssh on non-default port; `(wrong-type-argument number-or-marker-p nil)`

Problem In an org file, I have a source code block containing bash code that I want to run on a remote machine: * test :PROPERTIES: :header-args:bash: :dir /ssh:skid@127.0.0.1#2221: :END: #+...
0
votes
1answer
78 views

Can't evaluate plantuml in org-mode blocks

I have this weird error I don't understand : #+begin_src plantuml :file img/example-uml.png @startuml class Example { - value : Integer - other : Double + up() + down() } @enduml #+end_src This fails ...
0
votes
1answer
69 views

Org mode + Gnu Octave session

I interact with the Gnu Octave's inferior mode and everything seems to be working fine there: octave> pkg load symbolic octave> syms x g = (x+1)/sqrt(x^2 - 1) simplify(diff(g,x)) octave> g = (...
1
vote
1answer
58 views

org-babel-tangle error

I am experiencing a very unusual (concerning) error with my org-mode installation, and I am afraid that something might be broken. First, I have this setup in my .emacs file ;; Use my org-mode file as ...
3
votes
2answers
43 views

How to copy the content of the source block at point to the kill ring?

Suppose you're in org mode and working with source code. Your point is currently inside a source block at some random position. Is there an easy way to copy the body of source block (excluding #+...
0
votes
2answers
100 views

How to use C header files in org-mode source code blocks?

I have a C code block in my org-mode document like the following: #+begin_src C :exports both #include "my_header.h" int main(void) { function_from_my_header(); return 0; } #+...
1
vote
1answer
34 views

How can I set frame title to include Babel language when point is in a block

My frame title is currently set as (setq frame-title-format '(buffer-file-name "%f" ("%b"))), or for example /path/to/file.org. I'd like to set my frame title to include the ...
0
votes
0answers
10 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 + ...
0
votes
1answer
34 views

Output of shell command in source block is displayed as table

The output of the shell commands is displayed as table. How can I have it displayed as "simple" lines of text ?
1
vote
1answer
67 views

How to generate a PNG from a TikZ figure with org-babel?

I'm try to use org-babel to generate images from tikz code. The first code (take from this example) works perfectly, but when y want to export the tikz figure in a png (or a jpg) I have an error like ...
2
votes
2answers
188 views

Defining variables in org mode using tables

I often want to define a whole bunch of variables at the top of an org file. In some cases I think it would be really nice to define all the variables in a table. So far, the best solution I've come ...
3
votes
0answers
53 views

How to embed pgfplots picture in org-mode

I want to include tikz/pgfplots pictures in an org-mode document both for inline visualisation and export. I have tried approaches given in this emacs-orgmode thread and in the worg documentation ...
1
vote
0answers
48 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: :...
0
votes
1answer
55 views

Cannot evaluate matplotlib in Python code block

These are my first attempts to plot graph in Python. Following this example , I tried a very simple graph import matplotlib.pyplot as plt import matplotlib as mpl import numpy as np x = np.linspace(0,...
1
vote
1answer
70 views

library for code execution for markdown via org-babel

Are there any libraries out there that can take the markdown code fence block and execute it via org babel? Ie, something like '''js var a = 1 var b = 2 return a + b ''' Reasoning: I don't see not ...
1
vote
1answer
41 views

Find org babel header arguments documentation for shell language

The org manual specifies in the this link: https://orgmode.org/manual/Languages.html#Languages the language it supports (including shell). It mentions this: Additional documentation for some ...
0
votes
1answer
50 views

org-babel: define commands for all named source blocks in given set of files

This answer shows how to define a command that executes a named org-babel source block. If you want to do this for all named source blocks in a file, you could define one command per block. That's ...
0
votes
1answer
60 views

Is there a way to call M-x my-org-babel-block?

I have a named org-babel source block like this: #+NAME: my-org-babel-block #+BEGIN_SRC elisp :results output (print org-babel-load-languages) #+END_SRC Is there any way to call this block with M-x ...

1
2 3 4 5
13