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 do I set pdf-tools as default pdf-viewer? #117

Closed drjswalker closed 4 years ago

drjswalker commented 4 years ago

Hi, I really like fountain-mode which I use to script magic shows and small theatrical productions, and had a pretty good workflow from fountain mode through latex to pdf. In latex I could fine tune the typesetting, producing a customised, colorised script for magic shows using some scripted post processing. Auctex let me view the pdf using pdf-tools. It was a good workflow from start to printed copy where I didn't have to leave emacs. The afterwriting export is in my opinion a neutral advance, anychance we could get the latex export back as an option? The more pressing matter for me is how do I get the pdf to open in emacs via pdf-tools. I tried modifying dired-guess-shell-alist-user to evince as a test but can't seem to stop it asking for xpdf (which I have installed but pdf-tools or evince is/are much nicer.)

rnkn commented 4 years ago

The afterwriting export is in my opinion a neutral advance, anychance we could get the latex export back as an option?

No chance sorry. The LaTeX export required a full Emacs Lisp Fountain parser, plus a LaTeX screenplay template. Both of these were heavy maintenance burdens I no longer wanted to carry. Plus, to the best of my knowledge, the way LaTeX calculates page boxes meant it would never be possible to properly split dialogue across pages with the (MORE) and (CONT'D) strings.

The included export shell commands are just examples. You can change them to whatever you want if you don't like afterwriting. If there is a program out there that can convert Fountain to LaTeX you would be able to add this and maintain your existing workflow.

The more pressing matter for me is how do I get the pdf to open in emacs via pdf-tools. I tried modifying dired-guess-shell-alist-user to evince as a test but can't seem to stop it asking for xpdf (which I have installed but pdf-tools or evince is/are much nicer.)

Do you mean when you call fountain-export-view? This is calling a shell command, not an Emacs function. You can configure dired-guess-shell-alist-user to call "evince" to open externally, but if you want to view inside Emacs it's just find-file.

drjswalker commented 4 years ago

Fair enough on the latex export, but I cant seem to make the change to evince by setting dired-guess-shell-alist-user in my emacs init.el E.g.

(setq dired-guess-shell-alist-user '(("\.pdf\" "evince")))

Doesn't seem to work.

Any ideas why?

On Sat, May 9, 2020, 2:04 AM William Rankin notifications@github.com wrote:

The afterwriting export is in my opinion a neutral advance, anychance we could get the latex export back as an option?

No chance sorry. The LaTeX export required a full Emacs Lisp Fountain parser, plus a LaTeX screenplay template. Both of these were heavy maintenance burdens I no longer wanted to carry. Plus, to the best of my knowledge, the way LaTeX calculates page boxes meant it would never be possible to properly split dialogue across pages with the (MORE) and (CONT'D) strings.

The included export shell commands are just examples. You can change them to whatever you want if you don't like afterwriting. If there is a program out there that can convert Fountain to LaTeX you would be able to add this and maintain your existing workflow.

The more pressing matter for me is how do I get the pdf to open in emacs via pdf-tools. I tried modifying dired-guess-shell-alist-user to evince as a test but can't seem to stop it asking for xpdf (which I have installed but pdf-tools or evince is/are much nicer.)

Do you mean when you call fountain-export-view? This is calling a shell command, not an Emacs function. You can configure dired-guess-shell-alist-user to call "evince" to open externally, but if you want to view inside Emacs it's just find-file.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rnkn/fountain-mode/issues/117#issuecomment-626125736, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVBPQBCC77FCAB32SPYETTRQUE67ANCNFSM4M4RDHQQ .

rnkn commented 4 years ago

Use the customize interface, M-x customize-option

rnkn commented 4 years ago

I also thought, you might be best just viewing the PDF in pdf-tools then enabling auto-revert-mode.

drjswalker commented 4 years ago

That's how I usually do it; a buffer on autorevert that i can switch to. I was just spoiled by having it come up in pdftools automagically from auctex mode when I said view. I've been trying to figure out if I can use the server mode and call emacs as the viewer. I'm also still wondering why my init.el file entries to modify the list of shell calls won't work. I'm doing something wrong but cant see just what yet. They should be doing the same thing as the customization process. I'll fiddle with it some more. In the meantime, I have a workable process. Thanks again for a great job on fountain mode.

On Sun, May 10, 2020, 7:16 PM William Rankin notifications@github.com wrote:

I also thought, you might be best just viewing the PDF in pdf-tools then enabling auto-revert-mode.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rnkn/fountain-mode/issues/117#issuecomment-626422467, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVBPQBL7JNOKW7VTP5IB33RQ5GXFANCNFSM4M4RDHQQ .

drjswalker commented 4 years ago

Oh btw, I wanted to put pdftools and evince in as selectable options in the dired choice list because I dont have pdftools set up to print to cups yet so I would bring up evince to print hardcopy for stage managers script books etc.

On Sun, May 10, 2020, 7:34 PM John Walker drjswalker@gmail.com wrote:

That's how I usually do it; a buffer on autorevert that i can switch to. I was just spoiled by having it come up in pdftools automagically from auctex mode when I said view. I've been trying to figure out if I can use the server mode and call emacs as the viewer. I'm also still wondering why my init.el file entries to modify the list of shell calls won't work. I'm doing something wrong but cant see just what yet. They should be doing the same thing as the customization process. I'll fiddle with it some more. In the meantime, I have a workable process. Thanks again for a great job on fountain mode.

On Sun, May 10, 2020, 7:16 PM William Rankin notifications@github.com wrote:

I also thought, you might be best just viewing the PDF in pdf-tools then enabling auto-revert-mode.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rnkn/fountain-mode/issues/117#issuecomment-626422467, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVBPQBL7JNOKW7VTP5IB33RQ5GXFANCNFSM4M4RDHQQ .

rnkn commented 4 years ago

You can add && xdg-open %B.pdf or && evince %B.pdf to your export command. I doubt you'll easily be able to call back to Emacs from within a shell process started from Emacs, but you could look into the with-editor package.

To figure out your init issue, it might help to open the option in customize and select State > Show Saved Lisp Expression.

drjswalker commented 4 years ago

Thanks for the tip. I'll give it a shot.

On Sun, May 10, 2020, 11:33 PM William Rankin notifications@github.com wrote:

You can add && xdg-open %B.pdf or && evince %B.pdf to your export command. I doubt you'll easily be able to call back to Emacs from within a shell process started from Emacs, but you could look into the with-editor package.

To figure out your init issue, it might help to open the option in customize and select State > Show Saved Lisp Expression.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rnkn/fountain-mode/issues/117#issuecomment-626479308, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVBPQB5YXT5GK4RPK2GTYTRQ6EZ3ANCNFSM4M4RDHQQ .