rnkn / fountain-mode

Emacs major mode for screenwriting in Fountain plain-text markup
https://fountain-mode.org
GNU General Public License v3.0
391 stars 16 forks source link

How to make dialogs format correctly when inserting text #99

Closed forthrin closed 5 years ago

forthrin commented 5 years ago

I have two related questions regarding dialogs. Let's say you have this:

                        JOE
              What is going on?
  1. If I keep typing after the question mark, the cursor will go on to column 70, and then insert a newline and continue on the next line. This is not coherent with how screenplays look, where dialog text is narrow (maybe 20 characters wide). How do I configure fountain-mode to adhere to this?

  2. If I insert text before "What", then the line grows even beyond 70 characters. If i try to use fill-paragraph, the entire paragraph including "JOE" turns into one text blob, completely incorrect. How do I make dialogs -- manually or automatically -- format correctly when prepending text?

rnkn commented 5 years ago
  1. Unfortunately this isn't possible in Emacs. The way Fountain Mode aligns character and dialogue elements is to use line-prefix and wrap-prefix display variables, which only exist for the beginning of visual lines, not the end. The element aligning is only really intended as a fast visual hint at what elements you're writing, not really as a screenplay facsimile.

  2. This one is a little more complex and has to do with how a major mode defines fill-paragraph-function, which Fountain Mode doesn't define, because given that the Fountain syntax dictates that all line-breaks are to be treated as intentional, this would mean that filling a paragraph in Emacs would result in hard line-breaks in your output, which would result in a mess most of the time.

forthrin commented 5 years ago

@rnkn: Thanks for your quick reply. 1 is understandable, but 2, how is one supposed to work sanely with this? Manually struggle with reformatting the text, fixing newlines every time you prepend text?

Is it an alternative to make lines infinitely long so that no newlines are inserted at all during editing, only when exported to a final document? How would one do this, if so?

rnkn commented 5 years ago

I think I know what's going on. Are you using auto-fill-mode? Sometimes this is set as a hook for text-mode from which fountain mode is derived. Because of the way Fountain syntax understands line-breaks, you'll need to stick with visual-line-mode for wrapping text. I think this is what you mean by making lines infinitely long — lines are then only visually wrapping at the window edge.

forthrin commented 5 years ago

This seems much better! I've now enabled visual-line-mode and will see how it works. I assume it will be a good solution. You should make this your default (or at least add it to your manual).

rnkn commented 5 years ago

This should be the default value for fountain-mode-hook. You can see by M-x customize-option RET fountain-mode-hook RET.