[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#21729: doc-view messed up by early auto-revert
From: |
Stefan Monnier |
Subject: |
bug#21729: doc-view messed up by early auto-revert |
Date: |
Thu, 22 Oct 2015 09:10:14 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
> i.e., I revert the buffer from an AUCTeX hook that's run after the
> compilation has finished.
That's a good approach if you run pdflatex from Emacs itself, yes.
[ Hmm... I guess I could also use emacsclient to get the same result,
but it'd be a personal hack rather than a general functionality like
auto-revert-mode. ]
>> - Doc-view should inhibit auto-revert when the file was modified too
>> recently (on the assumption that it's not complete yet).
> Something like checking if the file's MTIME is more than a second ago?
Yes.
> Hm, no, that won't work. I currently work on some large document (~450
> pages). When I compile that, the file changes several times per second
> during the compilation, then it doesn't change for ~15 seconds while
> latex (lualatex in this case) is still running, and then starts changing
> again for maybe 3 seconds.
So we could additionally either check that the file is valid, or simply
"fail gracefully" if it isn't (e.g. keep displaying the old image, and
emit a message pointing to C-c C-c to see the raw data). But it's not
a deal breaker: in your case, we may end up trying to revert the file
too early, which is annoying, but as long as we do end up re-reverting
it when the file is finally complete, I think it's OK.
>> - [ Just guessing here: ] We may sometimes fail to revert the file
>> after it's complete, maybe because the last reversion finished after
>> the file was complete, even though it started before, so the last
>> reversion failed to include some changes that were added while the
>> buffer was being reverted.
> Yeah, that's possible. And I think there could also be a problem when
> people use latexmk which compiles your document several times until all
> refs are defined and its stable. Here, we might revert exactly between
> two latex runs.
I don't think reverting between two latex runs is a problem. It might
be "wasted work", but for a generic functionality like auto-revert-mode,
there's no way to do better since it can't know that another run is
about to come.
Stefan