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

added a "production" wrap option for export. #118

Closed corvore closed 4 years ago

corvore commented 4 years ago

This simply adds the "-p" flag to the "wrap pdf" export function as a new fountain-mode export option.

I write for animation, and need scene numbers in scripts all of the time. Having this option in fountain-mode will keep me from having to jump to the command line.

I've already been using this on my own, and thought others could benefit.

rnkn commented 4 years ago

I appreciate the PR. These options are only intended as examples that the user would then set per their own preferences with M-x customize-option RET fountain-export-command-profiles. Ideally rather than have exhaustive examples, it would be better to be clearer how to set the command profiles oneself.

Are you aware you can edit the command interactively? Prefix the command with C-u (i.e. C-u C-c C-e) and you can just add "-p" as you go. Shouldn't be a need to go to the command line.

corvore commented 4 years ago

All good! I didn't realize that. But that makes sense.

And good to know about C-u. I didn't know about that, actually.

Also, I'm a DOOM Emacs user, so M-x customize stuff is not available to me. Which means I needed to do it somewhere else. Since I was already adding the option, I thought I'd at least propose it to the project.

Thanks for making such an amazing tool! And again for the C-u tip.

rnkn commented 4 years ago

Doom Emacs prevents users from setting options via customize!? There are important side effects customize performs when setting options, e.g. https://github.com/rnkn/fountain-mode/blob/master/fountain-mode.el#L214-L222

corvore commented 4 years ago

I know! I love a lot of things about Doom, but that always throws a kink in some of my plans. I actually was trying to use customize to embolden the scene headings, but was forced to go a roundabout way.

I think Doom does have some ways of triggering defcustom settings using setq!. There are some unique config tools they've put together. But I haven't dug into them as much as I should have. https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#configuring-doom

Perhaps I'll have to go back to making my own config of vanilla emacs hehe. Some day.

rnkn commented 4 years ago

That's supposed to be a getting started guide? This kind of thing frustrates me. I think it is born of programmers wanting to demonstrate their cleverness, and so take something that is user-friendly and make it needlessly complex. You can genuinely have the same level of functionality you get from Doom Emacs via vanilla Emacs and customize.

rnkn commented 4 years ago

p.s. Thanks for alerting me that the interaction here is unclear. I will add some better documentation.

corvore commented 4 years ago

Yeah, it's kinda nuts. I should set aside some time and get back to playing with vanilla Emacs.

Appreciate the info! Thanks again!

And glad you got something useful from this hehe.

rnkn commented 4 years ago

Added some more doc. Please let me know if you feel there's more that could be clear.

diff --git a/README.md b/README.md
index e72c770..76023ab 100644
--- a/README.md
+++ b/README.md
@@ -38,14 +38,19 @@ functions and key-bindings, type `C-h m`.
 ## Exporting ##

 Earlier versions of Fountain Mode had export functionality, but this was
-never very good and there are several external tools available that better
-handle exporting:
+not very good and is better handled via interfacing with external shell
+tools, such as:

 - [afterwriting](https://github.com/ifrost/afterwriting-labs/blob/master/docs/clients.md) (JavaScript)
 - [Wrap](https://github.com/Wraparound/wrap) (Go)
 - [screenplain](https://github.com/vilcans/screenplain) (Python 2)
 - [Textplay](https://github.com/olivertaylor/Textplay) (Ruby, requires PrinceXML for PDF)

+The option `fountain-export-command-profiles` provides some shell
+commands to interface with these tools, but you are encouraged to edit
+or completely replace these to suit your own needs. The format is simple
+while still allowing for a lot of flexibility.
+
 ## Installation ##

 The latest stable release of Fountain Mode is available via
diff --git a/fountain-mode.el b/fountain-mode.el
index 7dc3704..5ef7439 100644
--- a/fountain-mode.el
+++ b/fountain-mode.el
@@ -62,14 +62,19 @@
 ;; ## Exporting ##

 ;; Earlier versions of Fountain Mode had export functionality, but this was
-;; never very good and there are several external tools available that better
-;; handle exporting:
+;; not very good and is better handled via interfacing with external shell
+;; tools, such as:

 ;; - [afterwriting](https://github.com/ifrost/afterwriting-labs/blob/master/docs/clients.md) (JavaScript)
 ;; - [Wrap](https://github.com/Wraparound/wrap) (Go)
 ;; - [screenplain](https://github.com/vilcans/screenplain) (Python 2)
 ;; - [Textplay](https://github.com/olivertaylor/Textplay) (Ruby, requires PrinceXML for PDF)

+;; The option fountain-export-command-profiles provides some shell
+;; commands to interface with these tools, but you are encouraged to edit
+;; or completely replace these to suit your own needs. The format is simple
+;; while still allowing for a lot of flexibility.
+
 ;; ## Installation ##

 ;; The latest stable release of Fountain Mode is available via
@@ -2880,6 +2885,9 @@ pdf %b --use-courier-prime --out %B.pdf")
     ("textplay-fdx" . "textplay --fdx < %b > %B.fdx"))
   "Shell command profiles for exporting Fountain files.

+n.b. The default command profiles are only intended as examples.
+You are encouraged to edit/replace these to suit your own needs.
+
 Each profile is a cons-cell of PROFILE-NAME string and the
 COMMAND string.

@@ -2900,7 +2908,10 @@ buffer or active region to the command via stdin.
 If a command outputs to stdout, this will be redirected to
 `fountain-export-output-buffer'.

-The first profile is considered default."
+The first profile is considered default.
+
+COMMAND may be edited interactively when calling
+`fountain-export-command' prefixed with \\[universal-argument]."
   :type '(repeat (cons (string :tag "Name")
                        (string :tag "Shell command")))
   :group 'fountain-export)
corvore commented 4 years ago

That's great! Appreciate the update. :)