Subject: bug#34593: 12.1.1; selecting xelatex from command menu does not reset dvips or dvipdfmx switches

From: Ikumi Keita <[email-masked]>
Date: Tue, 02 Apr 2019 16:00:31 +0900

Hi Jean, sorry for very late reply.

I think that the attached patch will do the job.  However it just resets
the "PDF from DVI" setting and doesn't restore it when you again change
the engine to, say, "default".
Is this what you wanted?  If so, I'll install this change.

Regards,
Ikumi Keita

>>>>> jfbu <[email-masked]> writes:
> Hi,
> Steps to reproduce.

> Any latex document previously set-up to do latex+dvips+ps2pdf
> (or dvipdfmx)

> select XeTeX as TeX-engine from menu.

> The dvips + ps2pdf (or dvipdfmx) option remains selected.

> On C-cC-a  errors arise, because of course no dvi file is produced from xelatex run.

> It takes a while until AUCTeX stops.

> On the positive side, with

> % Local variables:
> % TeX-engine: xetex;
> % End:

> and C-cC-n 

> the PDF from Dvi is reset and no problem arises.

> Could it be added that selecting "Use XeTeX engine" from menu automatically resets the "PDF from Dvi" setting ?

diff --git a/tex.el b/tex.el
index 3c3f1769..e8735473 100644
--- a/tex.el
+++ b/tex.el
@@ -1579,7 +1579,9 @@ For available TYPEs, see variable `TeX-engine'."
     (setq type (intern type)))
   (setq TeX-engine type)
   ;; Automatically enable or disable TeX PDF mode as a convenience
-  (cond ((eq type 'xetex) (TeX-PDF-mode 1))
+  (cond ((eq type 'xetex)
+	 (TeX-PDF-mode 1)
+	 (setq TeX-PDF-from-DVI nil))
 	((eq type 'omega) (TeX-PDF-mode 0))))
 
 (define-minor-mode TeX-Omega-mode