Stack Exchange Network

Stack Exchange network consists of 175 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 `working with source code` and no longer a separate extension.

0
votes
0answers
1 view

Unable to run applescript from emacs-lisp

I have the following code block, which I am trying to execute from org-babel: #+BEGIN_SRC emacs-lisp (let ((h (nth 5 (org-heading-components)))) (do-applescript (format "tell application \"...
0
votes
0answers
4 views

Grant Applescript via Emacs Lisp permission for UI scripting

I have a simple applescript, embeded in emacs-lisp, which uses the current org-mode heading to create a calendar event in Apple Calender. However... because scripting Calendar directly is painfully ...
0
votes
1answer
16 views

How to change org-babel interpreter location

Say I have my ditaa interpreter pointed to at /home/user/.emacs.d/elpa/contrib/scripts/ditaa.jar, how would I set it so it points to a different location?
2
votes
0answers
30 views

Print output from org code block immediately

I have an org mode file I use to run some moderately long analyses. Evaluating individual blocks may take 15 minutes to an hour or so. I usually wrap longer bits with calls to date, so I can later ...
0
votes
0answers
66 views

`org-mode` Python source and results output

I was wondering if it is possible to export command outputs right after the commands in the org-mode. So instead of: #+BEGIN_SRC python :results output :exports results print(1) print('a') #+END_SRC ...
0
votes
1answer
12 views

org src block php formatting adding commas to phpDoc

In the editing mode (C-c ') I formatted php code using TAB button. But in org mode src block it adds 2 comma to phpDoc.
0
votes
0answers
29 views

tramp gcloud compute ssh not working

I wanted to be able to ssh into my google cloud instances with spacemacs. I found: https://github.com/dustinfreeman/dustinfreeman.emacs.d/blob/master/init.el#L50 which is based off of: https://...
3
votes
1answer
48 views

org-export latex pdf output does not render svg

I tried out this section of code from this repo #+LATEX_HEADER_EXTRA: \usepackage{svg} ... #+PROPERTY: header-args :eval never-export :file-ext svg ... #+NAME: sequence12422 #+BEGIN_SRC plantuml :...
0
votes
0answers
13 views

Prevent parsing of text inside verbatim org results block

How do I tell emacs to not not apply treatments to text within a block like this. My issue is that, the * foo at the end causes the export to go bad. I'm using something similar to carl's setup -> ...
0
votes
0answers
12 views

Rmarkdown-like export of Leaflet for R webmap to html from org-mode

With RMarkdown it's easy to embed an interactive webmap. E.g.: --- title: Some title output: rmarkdown::html_document --- ```{r} library(leaflet) leaflet(width = "100%", height = "650px") %>%...
1
vote
1answer
29 views

use js2-mode instead of js-mode in org babel source

I want to use js2-mode instead of js-mode inside org-babel sources. Is there a way to define a mode for JavaScript inside those chunks? #+begin_src js console.log(1+1) #+end_src
0
votes
0answers
29 views

How to export org-babel document with ox-pandoc?

I want to export an org-babel document to html with bibliographies from a .bib file. The org-file is the following: #+TITLE: Test #+AUTHOR: Your Name #+EMAIL: your-email@server.com #+PANDOC_OPTIONS: ...
1
vote
1answer
43 views

How to export org-babel document?

In my .emacs file, I have the following variables: (custom-set-variables '(org-babel-load-languages (quote ((emacs-lisp . t) (R . t)))) '(org-confirm-babel-evaluate nil)) I save this example to a ...
1
vote
2answers
66 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
44 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
29 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->...
2
votes
0answers
25 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
32 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
38 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 ...
1
vote
1answer
122 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
33 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
1answer
227 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
295 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 ...
1
vote
1answer
18 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
34 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
32 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
29 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
54 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
50 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
144 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
343 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
196 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 ...
2
votes
1answer
42 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
96 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
76 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
41 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
19 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
64 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 ...
1
vote
0answers
34 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
72 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
39 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
138 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 ...
2
votes
0answers
48 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
61 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
121 views

quickly clear org babel results buffer

How to quickly remove this bit #+RESULTS: :RESULTS: ...
2
votes
0answers
65 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
1answer
99 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
64 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
46 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
202 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 ...