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 `...

0
votes
1answer
9 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 ...
1
vote
1answer
31 views

How to generate the result file for dot source block and include it with another path in org-mode?

I'm starting to write blogs with org-mode and org-static-blog, but now I'm stuck with a problem respecting exporting graphviz dot file to image file. So I have a code block like this with (setq org-...
0
votes
1answer
18 views

eval elisp code to fill org-babel header arguments

I use many org files with figures generated by source code blocks. By example, in an org mode file long/path/document.org I have: #+BEGIN_SRC dot :file my_fig.png :exports results digraph { A->...
1
vote
0answers
15 views

How to set a tangled parent directory for each subtree in org mode?

Base on this, one can set a global tangled file. However, I'd like to set one directory for each subtree, e.g. for a * Python subtree, in every code block I can set :tangle a.py or :tangle b.py ...
1
vote
0answers
25 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 ...
2
votes
1answer
24 views

Setting :stdin with #+call in org-mode shell code block

I've got the following code: #+NAME: example-block1 #+BEGIN_EXAMPLE Lorem ipsum dolor sit amet, consectetur adipisicing elit. #+END_EXAMPLE #+NAME: example-block2 #+BEGIN_EXAMPLE Sed do eiusmod ...
0
votes
1answer
44 views

No org-babel execute function for go

#+Begin_SRC go package main import ("fmt") func main(){ fmt.Println("emacs") } #+End_Src ~/.emacs.d/init.el: (when (memq window-system '(mac ns)) (exec-path-from-shell-initialize) (exec-path-...
1
vote
1answer
20 views

Export an orgmode buffer without expanding noweb references?

Normally, when I use orgmode's export function on a buffer that contains noweb references, they get expanded, resulting in lots of duplicated code throughout the exported HTML document. Is there a ...
0
votes
0answers
19 views

Org Babel Tangle Jump for noweb code

I am using noweb with org-babel. What I enter in org-mode is as follows #+BEGIN_SRC python :tangle yes :noweb tangle :comments noweb import sys import os def main(args): <<...
0
votes
1answer
73 views

org-babel-execute-src-block: No org-babel-execute function for R!

In org-mode, attempting to execute the following block... #+BEGIN_SRC R 1+2 #+END_SRC ...gives the error message org-babel-execute-src-block: No org-babel-execute function for R!. I have followed ...
4
votes
1answer
108 views

Using File Local Variables in org-mode

Is there a way to use file local variables set in an org-mode file in the following contexts: Simply expanding the variable when text is exported (eg: to LaTeX) Passing the value to :var in a babel ...
0
votes
0answers
35 views

Problem creating my org init file

I have one problem making my org init file. Every time I try to run the entire block by typing C-c C-c it says No org-babel-execute function for emacs-lisp! Do you know how can I solve this?
0
votes
0answers
31 views

I keep getting “No-org-babel-execute function for c” error

I have already added the following lines to my emacs init file (org-babel-do-load-languages org-babel-load-langugages '((C . t))) I keep getting the following error: I am using emacs ...
1
vote
1answer
15 views

Org babel R: why is 'NA' replaced with 'nil'

When using R in org mode source blocks, any NA (i.e. missing) values in tables get replaced with nil. Why is this? And is there a way to change this (globally, or at the file level)? I regularly ...
0
votes
1answer
30 views

is there something like org-babel for arbitrary major modes? [duplicate]

org-babel allows editing source code of arbitrary modes inside an .org file. I'd like to do this (with different syntactic markers) inside my major mode, but org-babel is very specific to org. Is ...
4
votes
1answer
28 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=...
0
votes
1answer
25 views

Catching warnings from sh source block

I've started on Learn C The Hard Way and want to collect my work in org mode. Executing rm ex1 && CFLAGS="-Wall" make ex1 in the terminal returns cc -Wall ex1.c -o ex1 ex1.c: In ...
0
votes
0answers
39 views

Why the difference when executing a shell script from a :session

I'm trying to do some git archeology but I've run into some weirdness with orb-babel and sub-shell expressions: #+name: get-aggregate-stats-debug #+header: :dir ~/lsrc/qemu/qemu.git #+begin_src shell ...
0
votes
1answer
35 views

Exit hook for org-src-mode

org-src-mode-hook is run upon editing a source block using org-edit-src-mode. Is there a way to set behaviour upon exiting editing a source block? In particular I would like to run blacken-buffer ...
8
votes
1answer
79 views

Does org have any “inverse-tangle” operations e.g. for collaborating with non-org users?

I would like to write my own notes/tests/code in org and then use org-bable-tangle to produce source files. However, all of these files are subject to version control and hence subject to change from ...
2
votes
1answer
199 views

Org-babel Python with :session

I don't know what happened with org-babel and Python recently. My intuition and my experience with preparing lectures last year was that the :session option would cause Org Mode to capture all the ...
7
votes
2answers
156 views

It is possible to instrument a literate Org-mode configuration file with a backing Emacs Lisp file?

It is a common practice to write Emacs configuration files using literate-programming style in Org mode. Unfortunately, while improving readability, this comes with significant programming ...
1
vote
1answer
28 views

Can I insert a prefix to Org Babel source code lines on export?

Like, say I have a shell script source code block. #+BEGIN_SRC shell echo 'Hello World!' #+END_SRC On export, I want the code text to pick up a dollar sign, so $ echo 'Hello World!'. But I only ...
0
votes
1answer
50 views

Choose individual startup visibility of org-mode's source blocks

In org-mode, how could one specify the visibility state of individual SRC_BLOCKs when a file is opened? org-mode provides the variable org-hide-block-startup to specify if all source blocks are shown ...
0
votes
1answer
42 views

How do I ensure org-sbe is consistently passed a string when copying tables

I'm trying to transform the data from one table to another however I can't do it with built in functions so I have to use org-sbe to call some elisp: #+tblname: clues | 02a8 | 0050 | 5012 | 2225 |...
1
vote
1answer
30 views

org-babel-execute:sql: reciving erros and no returns

#+name: Part 1 Task 1 #+header: :engine mysql #+header: :dbhost localhost #+header: :dbuser subject #+header: :dbpassword 1234 #+header: :database hmsec #+begin_src sql SELECT sensorId, type, ...
0
votes
0answers
16 views

org-babel interpreter prompts

is it possible to get org-babel to output the interpreter prompts and sessions, as if each expression in the src block had been entered into the repl... e.g. something like: #+begin_src ruby :output ...
3
votes
0answers
43 views

Apply ANSI color escape sequences for Org Babel results

Feature There is a nice built-in Emacs feature to colorize strings with ANSI color escape sequences. So evaluating the following Elisp code, will insert the "Test text" at the point with proper ...
0
votes
0answers
17 views

Bilingual text in .org mode and xelatex

I would like to typeset bilingual (English, Hindi) in emacs .org mode using mangal font available on windows . It has to be exported using xelatex. Kindly explain step by step setup for the same . I ...
1
vote
1answer
54 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 ...
0
votes
1answer
31 views

Org-mode export gets weird symbols at the end of each line while exporting to HTML

I got some source blocks in my org document like this one: #+BEGIN_SRC ipython print("Hola") #+END_SRC When the org file is exported to html (and only to html) I got weird symbols at the end of each ...
1
vote
1answer
99 views

Generate different markup for not-tangled code blocks in org-mode

Is there a way in org-mode's HTML export to make it so that code blocks that have :tangle no will appear differently? Even adding a different HTML class will do, as one can then probably add some CSS ...
1
vote
0answers
43 views

C-c ' for editing all code blocks (to handle imports and variables)?

The Org manual says: C-c ' for editing the current code block. It opens a new major-mode edit buffer containing the body of the ‘src’ code block, ready for any edits. This feature is sweet. ...
0
votes
0answers
44 views

org babel bash blocks - effectively writing non bash code

Something I often do (and I'm hoping other folks do too) is write a script and run it through a interpreter. Since I try to use org mode and org babel for scripting and literate programming, I end up ...
1
vote
1answer
104 views

quickly clear org babel results buffer

How to quickly remove this bit #+RESULTS: :RESULTS: ...
2
votes
0answers
54 views

Setting org-babel-load-languages in .dir-locals.el

As per the title, I'd like to set the org-babel-load-languages (to contain ditaa and calc languages) for a specific project only. The only solution I found so far is this one ( (org-mode . ...
0
votes
0answers
23 views

How to update code specific header argument in org mode

For the :file argument, I want to update it when I press C-c C-c (org-ctrl-c-ctrl-c)
0
votes
1answer
76 views

Interpreter discrepancy in org-babel-python and python-mode

(Emacs version 26.1, Org version 9.1.9) I have tried numerous solutions to get working in org-mode source blocks. This solution works to change python-mode to utilize the Python3 interpreter, which I ...
1
vote
1answer
48 views

Set correct gnuplot version

Due to a bug, I want to execute LD_PRELOAD=/lib/x86_64-linux-gnu/libreadline.so.6 gnuplot instead of just gnuplot to create plots with gnuplot. I already put an alias in my zsh source file, so that ...
3
votes
1answer
36 views

Evaluating all elisp org source blocks in buffer

Is there a way to evaluate all elisp org source blocks in the current buffer? The best I have now is: save to file, and do: (org-babel-load-file buffer-file-name) Is there a more direct way?
1
vote
1answer
142 views

SVG image from org-babel

I am trying to create a SVG image from latex code in an org-mode file. #+name: foo #+header: :file foo.svg #+begin_src latex bar #+end_src But I keep getting the following error: executing Latex ...
1
vote
1answer
68 views

How to add hline and column sum to bottom of table using a src block?

I want to (non-interactively) add (one hline and) a last line to a table in which the last column is summed. Like so: #+name: mytable | p | q | |---+---| | a | 5 | | b | 2 | #+begin_src emacs-...
0
votes
1answer
111 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:/...
1
vote
1answer
66 views

Dynamic IP address for org babel ssh dir param

I use this in emacs to connect and execute commands remotely: #+BEGIN_SRC sh :dir /ssh:app_user@34.143.149.84:/tmp pwd #+END_SRC #+RESULTS: : /tmp Recently, people have gone "cloud scaling" so the ...
2
votes
2answers
179 views

Running elisp within an orgmode code block

Consider the following elisp source code within a .org file: #+BEGIN_SRC elisp :results silent (delete-other-windows) (split-window-right) (switch-to-buffer-other-window '"*Python*") #+END_SRC This ...
4
votes
1answer
56 views

Inline babel source blocks in org table

(How) can I include (or their resulting variables) in an org table? * Inline code in table src_R{1+1} | src_R{1+1} | when exported to, e.g. HTML, results in Inline code in table 2 src_R{1+1}
1
vote
2answers
179 views

Accessing properties in org-babel source code blocks

noweb expantion is a very nice tool but it generally allows one to refer to other src-code blocks: #+NAME: hellomessage #+BEGIN_SRC emacs-lisp "hello" #+END_SRC #+BEGIN_SRC emacs-lisp :noweb yes (...
0
votes
0answers
15 views

How do I export the code behind a CALL block?

Emacs 25.3.1, Org 9.1.13 from GNU ELPA. I'm using the Library of Babel to store some code blocks that I frequently use. I incorporate them into my workflow just fine with #+CALL: some_lob_function()...
1
vote
0answers
110 views

Org-babel: Set root dir for tangled files

I have started using org-babel for a larger project, and have found the readthedocs to be a great resource. I have been using tangling to generate code from documentation, however setting the export ...
0
votes
1answer
40 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 ...