Closed ZungBang closed 4 years ago
Should be fixed now in master. This is a regression that seems to have been introduced in v3.
OK, so now it just hangs emacs at my end. It's stuck until I hit C-g
.
I'm testing this on the sample screenplay (Big Fish) from fountain.io.
On a related note (I think) - fountain-goto-page
does not match the actual pdf (I'm using the default export profile afterwriting-usletterpdf-doublespace
, with afterwriting v1.12.9
). It starts to lose sync at page 4 (point is moved to a line that is on the previous page in the pdf).
Counting pages is very computationally expensive. Big Fish takes a few seconds to count on my MacBook Pro.
Page count is only intended as approximate (as noted in the doc string). It's not really feasible to make it completely accurate within Emacs. Probably easier to just export a PDF.
Well, your MacBook Pro is very fast, since it's definitely an endless loop at my end :-)
When fountain-forward-page
starts from the first line of the last page (CUT TO BLACK
in our case), it stays put, so point
never advances and fountain-get-page-count
never stops since we don't get to point-max
. So, either fountain-forward-page
should reach the end of the buffer, or the stopping condition in fountain-get-page-count
should be modified.
Ah I see. It's because the version of Big Fish from fountain.io has no newline at the end of file. I'll get this fixed when I get a chance.
This would actually be a great PR. As you've discovered, not many people use the count pages feature so if it's important to you a PR would be most welcome.
See PR #127. Was kinda tricky to fix. Please review.
Shall we close this? The infinite looping is fixed, the accuracy is another story.
Sure.
This should let me estimate screen time while writing without breaking flow. I half expected it to not be accurate, but looking at the code, it just seemed complex enough to maybe be accurate. Thanks.
I'd give it about a 3% margin of error.
Just noticed that afterwriting breaks pages within sentences, whereas fountain-mode avoids breaking sentences. Might add an option to control this.
p.s. You've inspired me to try to improve the page counting code. I pushed a bunch of changes over the weekend to use text properties instead of recounting pages every time. Given you're familiar with this part of the code, could you do me a favour and take a look?
Aw shucks - was never accused of inspiring anyone before :-)
Played around with this feature a bit - way fast! way cool! Thanks!
One thing I noticed is that going to any page in Big-Fish gets you to the first character of the next page, and the page count reports the position correctly as the next page (e.g. goto page 3, count pages - page 4 of 121). Maybe you need to subtract 1 from the user entered page number?
Cool, thanks!
Page counting is now what I'd call accurate. Using the Big Fish script, some pages are off by a paragraph here and there, but overall calling fountain-goto-page
will get you to the same page in the PDF and in Emacs.
fountain-count-pages
fails with the following error messageand: Wrong type argument: number-or-marker-p, fountain-fill-action
Backtrace:
Tried to fix this myself, but it turned out to be a deeper rabbit hole than I expected ...