Skip to main content

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
1 answer
639 views

What to put into 'init.el' vs 'config.el' in Org-mode?

I'm using Org-mode to configure Emacs in a file 'config.el', which is really unstructured meanwhile. On the other hand, lots of configurations (for exemple the configs made with the menu) are in Emacs'...
OsunSeyi's user avatar
0 votes
1 answer
177 views

Trouble rendering lilypond source block in org-babel

I am relatively new to org mode and, as someone who enjoys writing about music, i decided to try org-babel-lilypond. I use MacOSx Monterey. I have lilypond installed via Macports, as was recommended ...
yvonneb's user avatar
0 votes
1 answer
111 views

org-babel shell session not starting

I'm trying to write some shell code blocks in a session, but it seems no session has been started, and all the code blocks are run independently. Here is a simple example: * org-babel :PROPERTIES: :...
Olivier Ma's user avatar
2 votes
1 answer
200 views

Org Babel ignores `org-plantuml-executable-args`

I cannot make plantuml set the UTF-8 charset, I've set '(org-plantuml-executable-args '("-headless -charset UTF-8")) in the init.el, but when I check in the message buffer the command ...
Daniele's user avatar
  • 657
8 votes
1 answer
3k views

Is there indentation in org src blocks?

I'm going kinda crazy trying to understand what's going on here... Asked this question on the r/emacs subreddit so apologies if any of you are seeing this again. Do org blocks allow TAB indentation ...
nonreligious's user avatar
1 vote
1 answer
245 views

How to evaluate Python code blocks with pipenv instead of system environment?

I'm trying to use org-mode as an alternative to Jupyter. I'm able to evaluate code blocks with system environment by doing C-c C-c on blocks, but I don't know how to evaluate it through pipenv ...
crocefisso's user avatar
  • 1,363
1 vote
1 answer
137 views

Skeleton for org source blocks causing issues

I've tried to setup a skeleton to speed up entering org source blocks (define-skeleton skel-org-block "Insert an org block, querying for type." "Type: " "#+begin_" ...
nonreligious's user avatar
0 votes
1 answer
205 views

conf "language" in org-babel

#+NAME: certfile #+begin_src emacs-lisp (cond ((eq system-type 'gnu/linux) "/etc/ssl/cert.pem") ((eq system-type 'darwin) "~/Mail/certificates/root-certificates.pem")) #+end_src ...
Nikita Fedyashev's user avatar
1 vote
0 answers
205 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
275 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
1 answer
111 views

clean weird characters from org source shell

When I run a shell command in Org I sometimes get back weird control characters: #+begin_src sh :results output :session test guix pull #+end_src #+RESULTS: : : Updating channel 'guix' from Git ...
Lorem Ipsum's user avatar
  • 4,527
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
2 answers
98 views

org-babel source block language specifier issue

I've installed j-mode and it works. But in an org-babel code block I have a strange issue. Spelling like begin_src J (capital J) allows me to evaluate the block, but has no syntax highlighting: #+...
Alex Shroyer's user avatar
1 vote
1 answer
166 views

Open org-src code edit buffer automatically upon starting edit

Editing src blocks directly in org file is nice but you cannot benefit from all minor modes that would be enabled in dedicated code edit buffer, more then that for a big babel file the performance ...
yuri's user avatar
  • 61
0 votes
2 answers
357 views

Org Tangle if file does not exist

I've been trying to work out if it's possible to tangle a file if it's not existent on the system. I came across Can Org Babel conditionally tangle code blocks based on system-type? which gave me a ...
user avatar
2 votes
0 answers
152 views

Why is the org-babel cache not populated on export

This whole question is an org-mode document that can be pasted into your local Emacs for a type-along question. First evaluate the below code block to enable caching of org-babel results, include ...
Rovanion's user avatar
  • 987
1 vote
1 answer
475 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
88 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
0 votes
0 answers
54 views

Inline image not showing

I am trying to display images inline in emacs, but for however reason the behaviour is not stable within the same document. Here is the problem: The below chunk works as expected: However, in the ...
lf_araujo's user avatar
  • 123
1 vote
0 answers
132 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
3 votes
0 answers
241 views

org-babel not sourcing remote .bashrc when using tramp

When editing a remote file with tramp, I want org-babel source blocks to source the remote machine's .bashrc. I found this workaround that does what I want: #+BEGIN_SRC bash :preamble ". ~/....
Alex Shroyer's user avatar
1 vote
2 answers
414 views

Using yaml src block in following python src block

I am trying to use multiple src blocks to explain a yaml config file usage in python. Below is my org file, #+name: config.yaml #+begin_src yaml name: john why: check # below is a dict example # see ...
hypothesisusable's user avatar
2 votes
1 answer
207 views

Setting :prologue in header args as elisp has "scope" problems when running (org-sbe), "wrong" `org-element-context`?

To cut down on some repetitive boilerplate, I'm attempting to make my header arguments more "dynamic", but I have run into what I believe is a "scope" issue, that I cannot yet get ...
Alex Stragies's user avatar
0 votes
0 answers
149 views

How to add ATTR_LATEX to all babel blocks efficiently?

I recently figured out how to make my babel codes to have a border background when export as pdf. I did it by adding the following before the BEGIN_SRC: #+ATTR_LATEX: :options frame=single This ...
mle0312's user avatar
  • 295
0 votes
1 answer
44 views

org-babel pass bibtex sample to python code block

Is it possible to pass a sample bibtex document into a python source code block to be evaluated? :PROPERTIES: :ID: d7154890-6d45-44c0-9b0c-9c0f6533c11e :header-args: :session bibtex :END: #+...
Sati's user avatar
  • 815
2 votes
1 answer
544 views

How to use PlantUML Server with Org mode?

plantuml-mode supports execution using a PlantUML server, with (setq plantuml-default-exec-mode 'server). I can set the server location with (setq plantuml-server-url "https://myserver.plantuml....
ch-pub's user avatar
  • 220
2 votes
1 answer
177 views

How to start a background process from Org?

The following code waits until process is finished, which is unexpected #+begin_src shell perl -wE 'sleep(3)' & disown #+end_src The work-around for that is to close STDIN and STDOUT explicitly #...
andreoss's user avatar
1 vote
0 answers
50 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
38 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
78 views

How to list all the code blocks in the current buffer with no #+NAME?

Let's say I have a buffer with some code blocks, but I want to know the location of those code blocks that doesn't have #+NAME set.
Rodrigo Morales's user avatar
0 votes
1 answer
70 views

Tangle current src block and process it in another

How can I run the test src block without leaving the code src block? Currently I must leave code, goto test, hit C-c C-c , go back to continue work on code #+NAME: code #+BEGIN_SRC sh :tangle /tmp/...
jjk's user avatar
  • 744
0 votes
0 answers
103 views

How to disable babel block indentation?

Is it possible to disable the indentation of new babel source blocks? I played with electric-indent-local-mode and org-src-preserve-indentation without success. Current output: * aa ** bb #+...
GP.'s user avatar
  • 213
0 votes
2 answers
79 views

Pandas output in Scimax

In Scimax, when I evaluate a pandas DataFrame (DF) in an Ipython block, #+BEGIN_SRC ipython data = [ ['a', 'foo', 'bar'], ['FOO', 'and', 'BAR'] ] pd.DataFrame(data) #+END_SRC It produces both ...
J.Doe's user avatar
  • 27
1 vote
1 answer
90 views

How to execute parameterized src block via elisp and get result?

I have a src block to get a value from some table: #+NAME: ref #+BEGIN_SRC emacs-lisp :var name="" table=main (let ((key (if (symbolp name) (symbol-name name) name))) (nth 2 (assoc key ...
andreoss's user avatar
4 votes
1 answer
400 views

org-mode spreadsheet formula, can one use the result of org-babel block?

I'm trying to find a way to use the output of existing org-babel block in org-mode spreadsheet formulae without rewriting them in emacs-lisp. Is it possible? TBLFM line is pseudo code, it is ...
Nikita Fedyashev's user avatar
0 votes
1 answer
538 views

org-babel multi-line header var

I'm trying to find a way how to conveniently edit(and pass) multi-line arguments to org-babel block. In the example below, ${name} variable is pretty convenient to edit as inline variable but for ${...
Nikita Fedyashev's user avatar
2 votes
0 answers
507 views

Jupyter-like setup with org-babel in spacemacs

I've been trying to switch my data-analysis workflow from Jupyter lab/notebook to org-mode + org-babel for quite a while. I'm looking for an emacs setup that will provide all the functionalities of ...
J.Doe's user avatar
  • 27
3 votes
0 answers
194 views

Set org source block name label as variable

Does someone know if it is possible to set the #+NAME label for source blocks as a variable? E.g.; I would like to be able to set the label with elisp, something like: #+NAME: (concat "name_"...
01000001's user avatar
3 votes
1 answer
100 views

prevent eval of a single src block

How do I ensure that only the second block never evaluates, while still allowing the first block to be evaluated normally? #+begin_src shell echo "hi" #+end_src #+begin_src python print(&...
Alex Shroyer's user avatar
0 votes
0 answers
92 views

Execute org mode code block without escape codes

When I run a bash code block I get a response which contains a lot of escape codes/sequences, which makes the results output less readable. Example below: How can execute the code block, without the ...
Hyperfocus's user avatar
5 votes
1 answer
1k views

How to pass org-babel code block as variable to another code block?

I would like to pass the code from code block test_python to script. I do not want test_python to be evaluated, but simply to have the source code inserted into script when I evaluate script. The goal ...
Kyle Harrington's user avatar
3 votes
1 answer
442 views

emacs org mode define a function in src block and call it

is there a method/package to use the following syntax to define and call a function? #+NAME: retX #+BEGIN_SRC python :var x=5 def retX (x): return x #+END_SRC ... Some text later... #+begin_src ...
skyfire's user avatar
  • 107
2 votes
1 answer
1k views

How to disable certain org-mode blocks from accidental execution

I have some shell code that can be dangerous to run on local machine in a org-mode source code block. Globally, I have configured org-mode to prompt for execution, but I would still like to make sure ...
Mingwei Zhang's user avatar
1 vote
1 answer
281 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
3 votes
1 answer
394 views

Automatically update a date in tangled files of an .org file?

I'm in the process of writing a LaTeX class using org-babel for the literate programming. In several places of the file .org file, I have to insert the release date of this class, at least in the ...
Denis Bitouzé's user avatar
6 votes
1 answer
1k 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: #+...
Reginald Marr's user avatar
0 votes
0 answers
321 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 (...
oleg harput's user avatar
1 vote
1 answer
232 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 --...
Zeta's user avatar
  • 1,103
1 vote
0 answers
519 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
2 votes
2 answers
566 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 ...
Vincent's user avatar
  • 141

1
3 4
5
6 7
17