Subject: Re: bug#23083: Reverting pdf in Multifile tex document

From: Mosè Giordano <[email-masked]>
Date: Mon, 28 Mar 2016 22:41:40 +0200

Hi Tassilo,

2016-03-27 22:02 GMT+02:00 Tassilo Horn <[email-masked]>:
> Waleed Yousef <[email-masked]> writes:
>
> Hi Waleed,
>
>> the good news is that the problem disappeared. However, a new problem
>> occurred.
>>
>> For some preamble (which is really weird) the pdf does not revert
>> (refresh); however it goes to the right page (but without
>> refreshing).  For the following preamble, when I comment some packages
>> the problem disappear!!
>
> Good catch!  We've called `TeX-after-compilation-finished-functions'
> only if `TeX-error-list' was empty with the intention that you don't
> want to revert when errors have occurred which usually means that the
> PDF will be broken anyhow.  However, your preamble issues lots of
> warnings, and those are collected in `TeX-error-list', too.
>
> I've fixed it in Git so that the hook is skipped only if there were real
> errors and not just warnings.  Here is the patch:
>
> --8<---------------cut here---------------start------------->8---
> modified   tex-buf.el
> @@ -1551,7 +1551,7 @@ Rerun to get mark in right position\\." nil t)
>                  (md5 (current-buffer)))))
>          (push (cons idx-file t) LaTeX-idx-changed-alist)))
>
> -  (unless TeX-error-list
> +  (unless (memq 'error (mapcar #'car TeX-error-list))
>      (run-hook-with-args 'TeX-after-compilation-finished-functions
>                         (with-current-buffer TeX-command-buffer
>                           (expand-file-name
> --8<---------------cut here---------------end--------------->8---

I changed it to use `TeX-error-report-switches' as it is simpler than
going through `TeX-error-list' and it's the usual way to test presence
of errors in the last TeX run.  Maybe we should turn the whole
`plist-get' call into a function.

Bye,
Mosè