Subject: bug#73854: 29.4; tex-mode: unexpected and inconsistent behaviour of `tex-compile`, `tex-file`, and `tex-view`

From: Stefan Monnier <[email-masked]>
Date: Sat, 19 Oct 2024 10:28:52 -0400

>> diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
>> index 6fc49800018..acb5bb4b860 100644
>> --- a/lisp/textmodes/tex-mode.el
>> +++ b/lisp/textmodes/tex-mode.el
>> @@ -2530,6 +2530,7 @@ tex-compile
>>        (if (tex-shell-running)
>>            (tex-kill-job)
>>          (tex-start-shell))
>> +      (setq tex-print-file (expand-file-name (tex-main-file)))
>>        (tex-send-tex-command cmd dir))))
>> 
>>  (defun tex-start-tex (command file &optional dir)
>> 
>> But I'm not familiar with the tex-mode.el code and don't know if this
>> change might have unwanted consequences (though it seems prima facie
>> safe).
>
> Stefan, do you agree with this fix?

No objections here.
Personally, I use `C-c C-c` to view the PDF (i.e. `C-c C-c` first to
compile the TeX file, then a second time to view the result).

So, maybe the patch below would also help.

        Stefan

diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 6fc49800018..f27bd1620e1 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -2212,6 +2212,7 @@ tex-compile-commands
      t "%r.dvi")
     ("xdvi %r &" "%r.dvi")
     ("\\doc-view \"%r.pdf\"" "%r.pdf")
+    ("evince %r.pdf &" "%r.pdf")
     ("xpdf %r.pdf &" "%r.pdf")
     ("gv %r.ps &" "%r.ps")
     ("yap %r &" "%r.dvi")