From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Cowley Subject: [PATCH] org-latex-compile timestamp checks Date: Thu, 14 Jan 2016 18:24:20 -0500 Message-ID: <57F8EBE2-E535-423A-828B-BCB3A2B9F797@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_2640142D-127D-4880-8104-C63ED38DC746" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38641) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJrFg-0002P8-0K for emacs-orgmode@gnu.org; Thu, 14 Jan 2016 18:24:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJrFf-0005da-4W for emacs-orgmode@gnu.org; Thu, 14 Jan 2016 18:24:23 -0500 Received: from mail-qk0-x235.google.com ([2607:f8b0:400d:c09::235]:33733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJrFe-0005ck-UI for emacs-orgmode@gnu.org; Thu, 14 Jan 2016 18:24:23 -0500 Received: by mail-qk0-x235.google.com with SMTP id p186so233156576qke.0 for ; Thu, 14 Jan 2016 15:24:22 -0800 (PST) Received: from ?IPv6:2607:f470:6:400d:397d:6fd6:9d67:61cd? ([2607:f470:6:400d:397d:6fd6:9d67:61cd]) by smtp.gmail.com with ESMTPSA id t73sm3420313qki.31.2016.01.14.15.24.20 for (version=TLSv1/SSLv3 cipher=OTHER); Thu, 14 Jan 2016 15:24:20 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --Apple-Mail=_2640142D-127D-4880-8104-C63ED38DC746 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 I=E2=80=99ve 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=E2=80=99s = 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. This does mean that there is the possibility of a false = positive in the compilation test if a successful compilation is followed = up by an unsuccessful compilation in less than one second. I do not know = if anyone encounters such a scenario. Anthony --Apple-Mail=_2640142D-127D-4880-8104-C63ED38DC746 Content-Disposition: attachment; filename=0001-lisp-ox-latex.el-PDF-generation-timestamp-check.patch Content-Type: application/octet-stream; name="0001-lisp-ox-latex.el-PDF-generation-timestamp-check.patch" Content-Transfer-Encoding: quoted-printable =46rom=20806fdc4e77ec85dd786d18fc72f49be99899b9cc=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Anthony=20Cowley=20=0ADate:=20= Thu,=2014=20Jan=202016=2018:13:45=20-0500=0ASubject:=20[PATCH]=20= lisp/ox-latex.el:=20PDF=20generation=20timestamp=20check=0A=0A*=20= lisp/ox-latex.el=20(org-latex-compile):=20Improve=20timestamp=20check=20= on=20HFS+=0A=20=20filesystem=20by=20only=20considering=201-second=20= clock=20resolution.=0A=0APreviously,=20the=20call=20to=20(current-time)=20= could=20return=20a=20timestamp=20with=0Aa=20non-zero=20microsecond=20or=20= picosecond=20fields,=20while=20the=20file=20attribute=0Aalways=20has=20= zeros=20for=20these=20fields.=20The=20check=20that=20the=20generated=20= file=20is=0Anewer=20than=20the=20reference=20timestamp=20only=20= succeeded=20when=20the=20time=20to=0Agenerate=20the=20file=20crossed=20a=20= 1-second=20clock=20interval.=0A=0ATINYCHANGE=0A---=0A=20lisp/ox-latex.el=20= |=203=20++-=0A=201=20file=20changed,=202=20insertions(+),=201=20= deletion(-)=0A=0Adiff=20--git=20a/lisp/ox-latex.el=20b/lisp/ox-latex.el=0A= index=20a57677b..188c076=20100644=0A---=20a/lisp/ox-latex.el=0A+++=20= b/lisp/ox-latex.el=0A@@=20-3576,7=20+3576,8=20@@=20Return=20PDF=20file=20= name=20or=20an=20error=20if=20it=20couldn't=20be=20produced."=0A=20=09;;=20= Check=20for=20process=20failure.=20=20Provide=20collected=20errors=20if=0A= =20=09;;=20possible.=0A=20=09(if=20(or=20(not=20(file-exists-p=20= pdffile))=0A-=09=09(time-less-p=20(nth=205=20(file-attributes=20= pdffile))=20time))=0A+=09=09(time-less-p=20(take=202=20(nth=205=20= (file-attributes=20pdffile)))=0A+=09=09=09=20=20=20=20=20(take=202=20= time)))=0A=20=09=20=20=20=20(error=20(format=20"PDF=20file=20%s=20wasn't=20= produced"=20pdffile))=0A=20=09=20=20;;=20Else=20remove=20log=20files,=20= when=20specified,=20and=20signal=20end=20of=0A=20=09=20=20;;=20process=20= to=20user,=20along=20with=20any=20error=20encountered.=0A--=20=0A2.6.4=0A= =0A= --Apple-Mail=_2640142D-127D-4880-8104-C63ED38DC746 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_2640142D-127D-4880-8104-C63ED38DC746--