[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] org-latex-compile timestamp checks

From: Anthony Cowley
Subject: Re: [O] [PATCH] org-latex-compile timestamp checks
Date: Fri, 15 Jan 2016 15:34:13 -0500

> On Jan 15, 2016, at 7:13 AM, Rasmus <address@hidden> wrote:
> Hi Anthony,
> Thanks for raising this issue.
> Anthony Cowley <address@hidden> writes:
>> I’ve had some trouble with toggling latex fragment previews in a
>> document on OS X. It would sometimes work, sometimes not, so I could
>> just try a few times until it worked and get on with things. Looking
>> into it more, the problem seems to be with the HFS+ filesystem’s
>> second granularity on file timestamps. The Org code checks that the
>> generated file is not older than a (current-time) obtained before
>> starting latex compilation, but the truncated time of the generated
>> file can indeed be older in the sub-second fields of the timestamp.
>> The attached patch simply compares timestamps truncated to 1-second
>> precision.
> Isn't this a bug in Emacs file-attributes rather than Org?  If so, it
> should be fixed in Emacs rather than worked around in Org IMO.

Thanks for taking a look, Rasmus! The bug is in Org, not Emacs. One may perhaps 
assume the invariant that successive calls to `current-time` will return 
non-decreasing values. One might also assume the invariant that successive 
touches of different files will result in file attributes with non-decreasing 
timestamps. It is mixing the two that is the bug, and Emacs itself shouldn’t 
try to fix that. To be clear, the limiting factor in this comparison is the 
filesystem whose timestamp granularity is much coarser than the system clock.

We could do something like generate an entirely separate temporary file before 
compilation, and use its timestamp as the reference by which compilation output 
is evaluated. However, the approach of checking file freshness with a 
one-second granularity seems like a pretty good compromise.

> Maybe you could just check the log directly for failures rather than
> checking the file attributes, if these are not reliable.
> Also, what is the ‘take‘?  I don’t seem to have it in my Emacs…

Sorry about that. Believe it or not I had already rewritten those two lines — 
as simple as they are — trying to not include extra dependencies. I’ve attached 
an updated patch that uses subseq from cl.el. I hope that is okay.


Attachment: 0001-lisp-ox-latex.el-PDF-generation-timestamp-check.patch
Description: Binary data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]