13

I am using org-mode with fountain mode to write a screenplay.

Org for organization and fountain for screenplay formatting.

This is the code I use for this purpose :

Settings for working with (fountain) source blocks in org.

;; prevent org from messing with indentation of the source text.
(setq org-src-preserve-indentation t)
(setq org-edit-src-content-indentation 0)

;; open the buffer for editing fountain in another window.
(setq org-src-window-setup (quote reorganize-frame))

;; prevent a message in the edit buffer from being shown.
(setq org-edit-src-persistent-message nil)

;; save edits in the fountain buffer to the org buffer after x sec
(setq org-edit-src-auto-save-idle-delay 1)

For example :

Act 1

** SQ 1

*** Scene 1

Bunch of text related to the scene and what the characters are doing and everything that I need to know but will never end up in the screenplay.

BEGIN_SRC fountain

screenplay text

END_SRC

Now I C-c ' and it opens the above in a new buffer and I can take it up from there.


The problem with my current set up is that it doesn't let me see the screenplay text in its entirety.

I have around 50+ such blocks and I'd like to achieve the following :

I want org to export all fountain blocks to a specific file, say fountain-screenplay. That way I have a single file with the screenplay only.

Have all edits synced with the org file. If I edit anything in fountain-screenplay, the source block in org should update the change and vice-versa.


To do this, I inserted the following properties in my org file :

:PROPERTIES:
:file: "~/files/fountain-screenplay.fountain"
:cache: yes
:comments: yes 
:tangle: yes
:results: silent
:END: 

When I C-c C-c it returns with an error saying that No org-babel execute function found.

And when I C-c C-v t it says 0 blocks tangled.

Is my approach incorrect or am I missing something?

Edit : I changed the properties to :

#+properties :file .fountain :cache yes and so on 

and when I C-c C-v t it tangles the source blocks to a filename.fountain. Now the sync part remains to be solved.

7
  • This is something that would be useful for programming too. You could have a look at outshine.el, it appears to take the opposite road (source file with comments which can be viewed in an org buffer), but it may come close to what you want. Disclaimer: it's never tried it myself (yet).
    – T. Verron
    Commented Jun 4, 2015 at 7:14
  • @T.Verron Outshine appears to be similar to lentic where the same file can be seen in separate buffers with different modes. I'll read more to check if has additional features that lentic doesn't. Commented Jun 4, 2015 at 8:20
  • This two-way syncing might exist (I don't think it does, but org mode features have a tendency to go unnoticed), but it would be tremendously easier to just toggle visibility of the non-fountain text. You can then still tangle to a file every once in a while.
    – Malabarba
    Commented Jun 4, 2015 at 18:11
  • There is a function org-babel-detangle that claims to to this (provide you tangled with link comments). I've never been able to get it to work.
    – erikstokes
    Commented Jun 4, 2015 at 23:21
  • 2
    I just tested the org-babel-detangle and it worked as expected, albeit I did very minimal tests, far from "production-code", but detangled correctly with linked comments
    – Joafigue
    Commented May 14, 2016 at 23:42

3 Answers 3

8

One widely known option that implements two-way round-trip linkage between different document formats (org and fountain, for example) within the same file is the lentic server feature developed by Phillip Lord. It can be installed as the lentic package through MELPA repository.

There is a screencast showing org-mode and lisp integration in the same file with two different editable views at the same time, linked. Changing in one makes changes in the other. Some initial setup may be required to accommodate the formats you need.

This is a richer integration, more suitable for editing, than say one-way output of tangle and detangle through org-babel.

1
  • 1
    I dispute the "widely known" statement, since I just found about lentic from your answer here. Also, as you can see on melpa, it has not as many installations, as I would have expected for a package that is basically pure magic! Commented Jun 6, 2019 at 13:59
2

Slightly late to the party, but I had the same wish to sync tangled blocks with their external files.

For this I can recommend org-tanglesync

This package looks for a :tangle <filename> property in the header of an org file and compares the block content to it. A diff is performed in the background, and then the user is prompted to pull or reject the external changes.

I find that this is more intuitive than org-babel-detangle because it does not require the external file to have extra org-babel magic for it to work, i.e. it is the source file that tracks the external exported blocks and not the other way around.

3
  • 3
    Can you elaborate?
    – user12563
    Commented Aug 18, 2019 at 21:17
  • 2
    What @DoMiNeLa10 said. Maybe say something about what that package does, and how using it as the solution here is different from using other proposed solutions.
    – Drew
    Commented Aug 19, 2019 at 1:01
  • 1
    updated, thank you for the helpful moderation Commented Aug 19, 2019 at 8:37
0

For this specific use case (fountain and org), fountain mode now has outlining built in. Just use # instead of *.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.