rnkn / fountain-mode

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

default script format #86

Closed pierwill closed 6 years ago

pierwill commented 6 years ago

It'd be great to be able to choose what format .fountain docs get opened in. I'd like to use stageplay formatting without needing the explicit metadata.

What might be the easiest way to implement this? I could take a stab at it. :)

Thanks for fountain-mode!!

rnkn commented 6 years ago

If you enabled auto-insert on find-file-hook then you'll get a prompt to add the format on visiting any new fountain file. Is this what you mean?

If you mean you want a variable default format (without having to add the line in metadata) then I kinda see this as a solved problem; the added work is not going to outweigh the effort to just add "format: stageplay".

The issue I foresee is that fountain-mode needs its default format to match a format present in a bunch of other variables. Right now, hard-coding "screenplay" works because I'm pretty sure that will always match a format in those variables. It would be easy enough to make the default format a variable, the hard thing would be making sure it always fell back on something if that variable didn't match. Does that make sense?

pierwill commented 6 years ago

Thanks for your response! Looking again, I'm sure you're right about the effort/payoff balance. A variable would be elegant, though, wouldn't it? Maybe I'll take a stab just for fun..

pierwill commented 6 years ago

Is there an easy hack somewhere to change the hardcoded behavior locally, or no?

Update: found one

pierwill commented 6 years ago

It would be easy enough to make the default format a variable, the hard thing would be making sure it always fell back on something if that variable didn't match. Does that make sense?

Couldn't it be set to a default value ("screenplay"), but optionally overridden on load in the user's init file?

rnkn commented 6 years ago

If you'd just like to change the default element alignment, here's the "screenplay" you can change:

https://github.com/rnkn/fountain-mode/blob/0edb39a4cc25a6ed40e139c4ac96499bca29cde8/fountain-mode.el#L540-L547

Couldn't it be set to a default value ("screenplay"), but optionally overridden on load in the user's init file?

Yes that's the easy part. The not-as-easy part is what happens if a user changes this to something bizarre, or to nil. It's probably easy enough, and looking back at the function above it probably already has the failsafe in the last line, I just don't see the reason to implement it.

A variable would be elegant, though, wouldn't it?

Well, there is a variable, which is format in the above function. It's just being defined within the function's lexical scope and set via the metadata.

Can you explain your use-case? The export templates in fountain-mode are only set up for screenplays, so in order to export a stageplay to PDF, you will need to use an external tool, in which case, that tool will need to know somehow that you want a stageplay, not a screenplay, so my assumption is that you're going to need the "format: stageplay" metadata anyway.

pierwill commented 6 years ago

Oh, it's just an aesthetic issue to me, not a huge need!

pierwill commented 6 years ago

(Although I suppose one direction the project could take would be toward script format agnosticism)

rnkn commented 6 years ago

Cool. I'll leave this open if I ever get the time/inclination to investigate it properly.