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

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
16 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
25 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
23 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 ...
7
votes
1answer
55 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
119 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 ...
6
votes
2answers
113 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
19 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
23 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
23 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
21 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
15 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
33 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
11 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
38 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
28 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
82 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
36 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
85 views

quickly clear org babel results buffer

How to quickly remove this bit #+RESULTS: :RESULTS: ...
2
votes
0answers
44 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
17 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
51 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
39 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
34 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
103 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
61 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
70 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
44 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
126 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
50 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
123 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
13 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
74 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
35 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 ...
2
votes
1answer
43 views

Org Mode's :output-dir and :file-ext arguments cause ALL output to be saved to files

Org Mode's Babel for executing code blocks provides two header arguments, :output-dir and :file-ext that were clearly intended to be used in the global document header, applying to all blocks. They ...
1
vote
0answers
73 views

how to “slow” down the execution of code blocks

on OSX 10.13.4 with emacs 25.3 and org-mode 9.1.12. Python is 3.5.2 with matplotlib 2.2.2 I am trying to find a way to have org-mode babel for python to slow down in some of the points of my code ...
0
votes
1answer
278 views

Python in org babel will not work

I've recently moved to a new computer and cannot get org babel to work with Python (it worked fine on my old machine). I'm using OS X 10.12.6 with Emacs for Mac OS X based on Emacs 25.3 with org-mode-...
1
vote
0answers
55 views

Org mode elisp in :var in header-args causing max-specpdl-size error

In org mode, :var header arg definitions can actually call functions, which is very nice! However I've run into a problem that I can't explain, exemplified by the following org file: #+NAME: add3 #+...
2
votes
0answers
27 views

Re-apply table formulas on org-mode export

I'm using an org-mode file to do some filesystem monitoring. To that purpose I have a table in which I'm calling code blocks through org-sbe in the formulas. It looks like this: #+NAME: part-size #+...
1
vote
0answers
39 views

get contents of source block

I'm trying go get the src block contents with (org-element-property :value (org-element-at-point)), but when I apply this on a block like: #+BEGIN_SRC emacs-lisp (print "foo") #+END_SRC the result ...
2
votes
2answers
177 views

ob-tangle or not?

I'm experimenting with Uncle Dave's config which is using a minimum init.el to launch config.org, which is full of elisp babel source blocks. Here's his relevant launching code: (when (file-readable-...
3
votes
1answer
139 views

How do I generate & tangle source code in a different language?

In an org file, I have a Perl source code block that generates SQL code. The Perl code is to be part of the exported document, but the SQL code is not; it is supposed to be tangled to the ...
0
votes
1answer
42 views

Trouble with org-export-before-processing-hook in .emacs

When I eval (add-hook 'org-export-before-processing-hook #'org-update-all-dblocks) in an emacs session, function org-update-all-dblocks seems to be called at the preprocessing stage of export, as ...
3
votes
2answers
170 views

Managing code libraries with org-babel

I want to take a literate programming approach to managing my library of code snippets with org-babel. I have a ~/Code folder which I use to save various org-mode documents, each of which contains a ...
0
votes
0answers
47 views

ob-ipython src code in mu4e-org message image location

Background The way to include ipython source code for data analysis, including the plotting library matplotlib in org-babel, is to start a jupyter-console in a shell and then copy the json kernel ...
2
votes
1answer
94 views

Querying remote postgres from org

this is a bit complicated, please bear with me I want to use org-babel to query postgresql, and I can do it for DBs that I can access directly from my localhost: #+begin_src sql :engine postgresql :...
1
vote
0answers
44 views

Save org-babel output with org-attach

I am using org-babel to write R code in Emacs org-mode. Here's an example: #+BEGIN_SRC R :session *R* :results output graphics :width 5 :height 5 data(AirPassengers) AP <- AirPassengers plot(AP) ...
1
vote
1answer
69 views

Force org to use `:` instead of `begin_example` for source block output

When executing a source block in org mode with the output set to verbatim, it will sometimes wrap the results in an #begin_example block, and sometimes it uses : symbols at the beginning of the line. ...
2
votes
0answers
75 views

Prevent Org mode from raising Emacs frame while exporting to PDF

Some of my org mode files take a long time to export because they include code for number crunching that is executed during export (via Org Babel) . I usually minimize the Emacs frame while the ...
2
votes
1answer
52 views

How to make org-babel call all remote code blocks under a specific headline?

For example, I have following org file: ***** user level ****** copy system service file At first copy system's systemd service file to systemd user level. by check it out, and tangle it to target ...