10

I've got multiple source blocks which are all tangled to the same file. When I invoke C-c ' inside one block, only this specific block is shown in a new buffer.

Is there a possibility to show all parts of this file inside this buffer (instead of just this specific snippet)?

Example:

#+begin_src emacs-lisp :tangle foo.el
(defvar *ok* "")
#+end_src

This is where the variable is stored...
#+begin_src emacs-lisp :tangle foo.el
(defun add-one (n) (+ 1 n))
#+end_src

If I hit C-c ' in the first block I get:

(defvar *ok* "")

but I want:

(defvar *ok* "")
(defun add-one (n) (+ 1 n))
Toothrot
  • 3,204
  • 1
  • 12
  • 30
beyeran
  • 221
  • 1
  • 3
  • 2
    There are functions `org-babel-tangle-jump-to-org` `org-babel-detangle` that claim to do this if you tangle with link comments (`:comments link` in the source block). I can't seem to get them to work right. – erikstokes May 23 '15 at 01:47

3 Answers3

3

I can reccomend org-tanglesync, which has a much simpler method of syncing than org-babel-detangle

Essentially if a block is tangled to an external file, then every time that block is edited, the external file is also checked, and if a diff is detected, the user is prompted to either reject or pull the external changes into the org src block.

This also has functions to automatically process all tangled blocks in a buffer.

Mehmet Tekman
  • 183
  • 1
  • 6
2

What you are looking for is a two-way editing feature that survives edits during the round-trip and not just one-way output common to tangle and detangle commands. The best solution I found is lenticular text that is available as the package lentic on MELPA.

Emacs User
  • 5,553
  • 18
  • 48
2

Add this header argument

#+PROPERTY: header-args+ :comments link

Tangle. You can now edit the tangled file itself and issue org-babel-detangle to get everything back into the org file.

Toothrot
  • 3,204
  • 1
  • 12
  • 30