Questions tagged [literate-programming]

64 questions
55
votes
6 answers

Can I use org-mode to structure my .emacs or other .el configuration file?

My .emacs configuration file gets bigger and bigger and I'd like to get a better overview and structuring by adding headings, subheadings and being able to hide or show them like I can do with Emacs org-mode. I noticed that I can activate org-mode…
MostlyHarmless
  • 1,395
  • 2
  • 13
  • 14
19
votes
2 answers

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 outside my org environment. I would like to be…
RJTK
  • 293
  • 2
  • 5
7
votes
2 answers

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 disadvantages. In particular, since there is no backing .el…
Matthew Piziak
  • 5,958
  • 3
  • 29
  • 77
7
votes
1 answer

One-liner org source tangle

At times, especially when taking notes, a literate org file can contain one-line source blocks, as follows: * Taking notes :PROPERTIES: :tangle: whatever.pl :comments: org :END: Perl set command #+BEGIN_SRC perl set $random_var=1; #+END_SRC Perl…
deejay
  • 193
  • 7
5
votes
1 answer

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 the org file becomes more than 20 for example,…
american-ninja-warrior
  • 3,773
  • 2
  • 21
  • 40
5
votes
0 answers

Indentation using multiple org src block

So, say I have a literate org file as follows: #+TITLE: Random Scrap * Do something :PROPERTIES: :tangle: scrap.pl :comments: org :END: #+BEGIN_SRC perl sub my_func{ my $var = pop; #+END_SRC some thoughts here.. and the func…
deejay
  • 193
  • 7
5
votes
1 answer

org-mode babel python code block to get current org file's location

I would like to use some python code with babel to output some computation result about the current org file. As I'll be doing this quite often, I'd like ideally to have access to it's file name without hard-writing it's name in my code. For…
vaab
  • 315
  • 1
  • 7
5
votes
0 answers

How to link from parent source block to child block (included via <>)?

When exporting the documentation (HTML or PDF) for a literate program that uses noweb references in blocks, how can I get the output to actually hyperlink the <> line (in the parent source code block) to the block named…
Sue D. Nymme
  • 1,406
  • 12
  • 13
5
votes
1 answer

Using a different major mode in comments

A programming language that I use lets me format comments and docstrings using markdown, and then export my code and documentation to PDF. When I edit the file, though, Emacs doesn't see comments as markdown; just as plain boring text. I would like…
Clément
  • 3,924
  • 1
  • 22
  • 37
5
votes
1 answer

Support to refactor/convert source into literate programming with org-mode/babel?

I'm thinking of using literate programming to investigate large amount, or hard to understand source code. For the purpose, I'd like refactor the source code into literate programming text with org-mode/babel, so that I can add annotations of my…
Yu Shen
  • 451
  • 4
  • 15
4
votes
1 answer

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 #+END_SRC * bar #+BEGIN_SRC sh :tangle…
jjk
  • 705
  • 4
  • 16
4
votes
1 answer

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-from-shell-copy-env "GOPATH")) ;; Define…
4
votes
1 answer

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 file. #+begin_src shell :results code :wrap "src…
stardiviner
  • 1,888
  • 26
  • 45
4
votes
4 answers

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/views/layouts/appication.html.erb file, with basics…
american-ninja-warrior
  • 3,773
  • 2
  • 21
  • 40
4
votes
2 answers

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(a+4) #+END_SRC * Preparation #+BEGIN_SRC python…
1
2 3 4 5