Skip to main content

Questions tagged [literate-programming]

The tag has no usage guidance.

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

How to pretty print my emacs configuration with literate programming?

I have done an emacs config with literate programming and I have been searching for while now. I need a simple tool with which I can just pretty print my code in my org file.
David's user avatar
  • 299
0 votes
0 answers
51 views

detangle preserve noweb

I've recently gotten into literate Programming with org-mode. I'd like to be able to write all my functions across multiple Code Blocks, tangle them into a files but also test them from inside the org ...
Tomke Pfoch's user avatar
2 votes
1 answer
87 views

Configuring Key-bindings from Org-Table

I use init.org file to configure my emacs, and then tangle it into init.el. Now, I would like to configure my keybindings from org-table (for more readable and printable). Basically, I'd like to only ...
Garid's user avatar
  • 666
1 vote
2 answers
144 views

run check-parens or similar when saving or tangling literate configuration?

I use org babel to load my literate configuration file "config.org". But sometimes when editing that org file, I introduce some error -- say, a missed parenthesis -- and then restart emacs. ...
Dan Drake's user avatar
  • 625
1 vote
1 answer
73 views

Splitting use-package declarations in literate config

Trying to clean up my configuration and make it more readable, but also reduce load time from current time of about 13 seconds down to < 10. Suppose I have a large use-package macro for a package ...
nonreligious's user avatar
0 votes
0 answers
50 views

org-babel-detangle writes duplicated code

I am trying to use org-babel-detangle for a while, but the source code is detangled twice in the main org file. Interestingly, when I run (org-babel-detangle "file_name.cpp") it does not ...
Gabriel Petrini da Silveira's user avatar
0 votes
0 answers
24 views

Why does a named org-mode source code block get used when it was only declared and not used in another source block?

it's required to have #lang racket to use the substring procedure. So I defined it like this: #+NAME: directive #+begin_src racket #lang racket #+end_src #+begin_src racket :var directive=directive (...
mustaqim's user avatar
0 votes
1 answer
73 views

Add parent heading of source code block as comment in tangled file

If I have something like this: * Function heading #+begin_src racket :var x=3 y=4 :tangle "file.rkt" (define (distance x y) (sqrt (+ (sqr x) (sqr y)))) (distance x y) #+end_src ...
mustaqim's user avatar
2 votes
1 answer
133 views

How to divide too long header-arguments of src-block into multiple lines?

I'm trying to process tens of tables (from multiple org-files) in python src-block at once. Suppose that the following file: /tmp/file1.org contains some tables: * This org contains the tables #+name: ...
Garid's user avatar
  • 666
0 votes
2 answers
268 views

Exporting images from #+RESULTS in org code blocks does not work

When exporting images to multiple formats (I have tried html and pdf), the export works but the image is not displayed. This is only a problem when the image is in a #+RESULTS: block. Moving the image ...
Dirk's user avatar
  • 3
2 votes
2 answers
387 views

Evaluate Single Python Code Blocks in a Quarto File like in R Studio or Jupyter Lab

Quarto is a literate programming framework. It allows you to combine in a single file code (in various programming languages) and text (in markdown).* When a Quarto document is rendered, the output ...
henning no longer feeds AI's user avatar
2 votes
2 answers
577 views

How do I define default language for org-mode source code blocks?

I want to do literate programming. Entering language after every code block is prone to errors and distracting. To make matters worse, I do not know how to verify if all my blocks were tangled. I can ...
ruby_object's user avatar
1 vote
1 answer
164 views

Tangle babel code to specific location in source file?

Let's say I'm creating many babel code blocks in a growing org-mode buffer and I'm tangling them all to a single file. However, I want certain blocks to appear above others. For example, #+begin_src ...
147pm's user avatar
  • 2,979
1 vote
1 answer
136 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
398 views

How to use Org mode for i3/sway config files

I use the swaywm. It's similar to i3. The Emacs distribution I use is doom-emacs I recently learnt about literate config files. But how make literate configs for something like this. The text is not ...
Sujay R's user avatar
1 vote
1 answer
363 views

Manage JSON (comments) with org literate programming and tangle

I would like to manage a JSON config file with added comments on some key-value-pairs and explain options. Since it is not possible to comment in JSON, I thought about using org-mode literate ...
breathe_in_breathe_out's user avatar
0 votes
0 answers
293 views

noweb doesn't expand at all

I have a feeling this must be a stupid simple problem however I just can't seem to figure out what I'm doing wrong. I'm using Doom emacs and trying to use noweb with org mode source code blocks to ...
Reginald Marr's user avatar
1 vote
1 answer
152 views

Spacemacs gg=G replacing tabs with spaces in org-babel makefile block

I'm using Spacemacs, and my org-mode file contains an org-babel block of Makefile code, which I want to "tangle" so it becomes part of the source code while remaining in sync with the ...
Alex Shroyer's user avatar
3 votes
2 answers
4k views

Saving Python matplotlib figures with source-code blocks

So I am trying to create a Data Science workflow using org-mode source-blocks. Basically, I need to emulate the jupyter notebook functionality where you create a plot and it shows the figure. Now, ...
user avatar
0 votes
1 answer
134 views

Confusion about header arguments

I get that there are different levels at which Header arguments in org mode, specifically LP can be defined and that the more specialized ones, i.e. deeper within the tree hierarchy, take precedence ...
CD86's user avatar
  • 573
2 votes
2 answers
412 views

Split code across multiple SRC blocks?

For my current config, I'm tangling an org-mode buffer into my init.el, and I have a few sections where I'd like to insert rich text between segments of Emacs lisp code, like the following: ... #+...
Jakob's user avatar
  • 21
2 votes
2 answers
202 views

Managing path for reproductible scientific paper using session, org-babel and org-mode

I'm starting using org-mode and org-babel to support my day by day scientific work and produce reproductibles papers. Lot of people use rMarkdown/jupyter to do that, but i'm interested by investing ...
reyman64's user avatar
1 vote
1 answer
170 views

How to unpack a tuple from org-sbe evaluating a python code block into multiple columns of a org-table?

I often encounter situations where I can easily think of python code that, given some input values, computes multiple output values at once. As an example, consider the following simple code-block ...
Christian Herenz's user avatar
2 votes
1 answer
119 views

How to concatenate similar groups of blocks during tangle with noweb syntax?

I used to have a literate configuration file structured as follows: #+BEGIN_SRC emacs-lisp :tangle "/tmp/out.el" :noweb yes ;; requirements <<require>> ;; other <<execute>> ...
coredump's user avatar
  • 166
0 votes
0 answers
43 views

Set source block name for org section

Expanding <<foo>> using noweb works with #+NAME: foo above one src block. Why is this one not expanded? ** My org section :PROPERTIES: :header-args: NAME: foo :END: #+...
jjk's user avatar
  • 744
1 vote
0 answers
74 views

Leave noweb references in Org-Babel unevaluated with variables

I'm currently getting into Literate Programming with org-mode in Emacs. One of the key features to make it tractable as a programming style is macros. I would like to be able to do something like this:...
Suskeyhose's user avatar
0 votes
0 answers
256 views

How to tangle conditionally based on hostname?

Why is this block tangled (bar.sh), but not the second (foo.sh)? #+BEGIN_SRC sh :tangle bar.sh echo bla #+END_SRC bla #+BEGIN_SRC emacs-lisp :tangle (when (eq system-name 'arch) "foo.sh") (princ ...
user3166159's user avatar
4 votes
1 answer
947 views

How to use org headers as filenames in tangle

In org mode, how can I tangle to files equally named as the org header? Referring to the examples below, I'd expect two files foo.sh and bar.sh as tangle result: * foo #+BEGIN_SRC sh :tangle yes ls #...
jjk's user avatar
  • 744
5 votes
1 answer
2k 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-...
Ali Hassan's user avatar
0 votes
1 answer
86 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 ...
fommil's user avatar
  • 1,800
19 votes
2 answers
3k 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 ...
RJTK's user avatar
  • 293
7 votes
2 answers
685 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 ...
Matthew Piziak's user avatar
2 votes
1 answer
564 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 ...
ShreevatsaR's user avatar
2 votes
0 answers
68 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. ...
kuzcoTheGreat's user avatar
3 votes
1 answer
1k views

How to call org-lint against org-mode file from command-line

I am configuring a CI/CD pipeline to process org-mode files into documentation, source code, and other file formats. I would like to add a call to org-lint to do basic syntax checking against org ...
Melioratus's user avatar
  • 4,688
1 vote
1 answer
719 views

Managing source code annotations and version control

I would like to be able to annotate source code files with my own personal notes, strip these notes out before committing to version control, and merge changes back in from version control without ...
user234461's user avatar
2 votes
2 answers
1k 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-...
147pm's user avatar
  • 2,979
4 votes
2 answers
1k 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 ...
Adam's user avatar
  • 1,907
4 votes
1 answer
774 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 ...
stardiviner's user avatar
  • 1,948
2 votes
1 answer
93 views

How to avoid accidentally writing temporary source-block-edit-buffers to file

When doing literate programming in org-mode, I frequently use C-c '[aka M-x org-edit-special] to enter the source-block-edit-buffer, so that I have appropriate yasnippets etc. I then accidentally ...
Alex Stragies's user avatar
4 votes
4 answers
1k views

literate programming: do folks revise tangle blocks or make copies

So I'm making a website using an org document and tangling. I've created the basic structure of the site using * file coolsite.org #+BEGIN_SRC sh rails new coolapp #+END_SRC This creates a app/...
american-ninja-warrior's user avatar
5 votes
1 answer
293 views

switch-buffer for literate programming

When doing literate programming, I do web development in a single org file, and do org tangle to generate the relevant html and css files. This works, for a few hours/days. When the number of files in ...
american-ninja-warrior's user avatar
2 votes
1 answer
156 views

Can tangling embed code in external files? instead of recreating files

I'm building a web application using the literate programming style. At least trying to. I wanted to "hit the ground running", so I decided "make a copy" of one of the many "starter apps" https://...
american-ninja-warrior's user avatar
4 votes
1 answer
1k views

noweb function call with variable arguments

I get error "reference y not found in this buffer" when trying to evaluate cubed-plus-cubed: #+NAME: cubed #+BEGIN_SRC python :var x=3 return x * x * x #+END_SRC #+RESULTS: cubed : 27 #+NAME: cubed-...
user3496846's user avatar
4 votes
2 answers
1k views

Order of blocks in org tangle

I want to create an org file with two sections, that reads in that order but "tangles" first the second section. For example, if my org file is * Generic section #+BEGIN_SRC python :tangle yes print(...
RedPointyJackson's user avatar
4 votes
1 answer
179 views

EMACS shell mode that supports annotations

I often find myself doing things like installations or debugging where I would like to be able to work in shell mode but be able to insert annotations as I go. BBEdit has something like this but ...
Charlie Martin's user avatar
3 votes
1 answer
176 views

How to stop main wrapping when tangling C in org-babel?

Please consider the following self-contained, minimal example org file: #+name: zepto-c #+CAPTION: A tiny C file #+begin_src C++ :tangle zepto.c #include "zepto.h" void foo (void) {} #+end_src #+...
Reb.Cabin's user avatar
  • 721
3 votes
0 answers
352 views

Literate agda programming in org-mode

How could I write literate (and exportable to latex) Agda code in org-mode? Org-babel would be a great option, but there is no ob-agda2 (I think?). I have tried defining an org-babel-execute function ...
Mario Román's user avatar
2 votes
1 answer
140 views

The correct way to declare common vars in babel

I'm playing with the idea of "literate devops" with org-mode. To simplify scripts i've extracted common values into :PROPERTIES: drawer, which looks like this: * Scripts ** Subscripts-A *** ...
4lex1v's user avatar
  • 613
1 vote
1 answer
740 views

org-babel-load-file doesn't load entire file

In ~/.emacs.d/init.el I'm calling my annotated configurations file settings.org like so: (require 'ob-tangle) (org-babel-load-file (expand-file-name "~/.emacs.d/settings.org")) This generates ...
pandita's user avatar
  • 235