Subject: Preview LaTeX doesn't work when a theme is loaded

From: Berthold Lorke <[email-masked]>
Date: Sat, 1 Jun 2019 17:04:51 +0200 (CEST)

Preview LaTeX works fine when no theme is loaded.
On vanilla Emacs 26.2 with only AucTeX installed, it works, but as soon as I load any theme (via customize, the default themes that come with emacs), any preview-latex command (e.g. C-c C-p C-b) I try won't show a LaTeX image in place of a math mode region.
I get the no entrance sign icons, and when I click on it with Mouse-3, I get the following.

"
/usr/bin/rungs -dOutputFile\=\(_region_.prv/tmpqsqKfU/pr1-1.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r77.8506x77.8366
GS>{<</PermitFileReading[(_region_.pdf)(_region_.prv/tmpqsqKfU/preview.dsc)]>> setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped pop/.preview-BP currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne or{.preview-BP 0.996109 0.996109 0.996109 setrgbcolor clippath fill 0.199222 0.199222 0.199222 setrgbcolor}{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{/.preview-ST[count 4 roll save]def dup length 0 eq{pop}{setpagedevice}{ifelse exec}stopped{handleerror quit}if .preview-ST aload pop restore}bind def /GS_PDF_ProcSet GS_PDF_ProcSet dup maxlength dict copy dup begin/graphicsbeginpage{//graphicsbeginpage exec 0.199222 0.199222 0.199222 3 copy rg RG}bind store end readonly store  (_region_.prv/tmpqsqKfU/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 410()/SubFileDecode filter cvx exec .preview-ST dup dup 410 setfileposition 50()/SubFileDecode filter cvx<<>>preview-do
Error: /undefined in GS_PDF_ProcSet
Operand stack:
   GS_PDF_ProcSet
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:739/1123(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 644
GS<1>
"

The LaTeX compilation initialized by the preview command doesn't show any errors.g
I tried it on a friend's machine and I was able to reproduce the same behaviour.

Emacs  : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.8)
 of 2019-04-12
Package: 12.1.2

current state:
==============
(setq
 AUCTeX-date "2019-02-08"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex" "/tmp/.emacs.d/elpa/auctex-12.1.2/style"
		  "/tmp/.emacs.d/auctex/auto" "/tmp/.emacs.d/auctex/style"
		  "auto" "style")
 TeX-auto-save nil
 TeX-parse-self nil
 TeX-master t
 TeX-command-list '(("TeX"
		     "%(PDF)%(tex) %(file-line-error) %`%(extraopts) %S%(PDFout)%(mode)%' %t"
		     TeX-run-TeX nil
		     (plain-tex-mode ams-tex-mode texinfo-mode) :help
		     "Run plain TeX")
		    ("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil
		     (latex-mode doctex-mode) :help "Run LaTeX")
		    ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil
		     (texinfo-mode) :help "Run Makeinfo with Info output")
		    ("Makeinfo HTML" "makeinfo %(extraopts) --html %t"
		     TeX-run-compile nil (texinfo-mode) :help
		     "Run Makeinfo with HTML output")
		    ("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %t"
		     TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
		    ("ConTeXt"
		     "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t"
		     TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
		    ("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t"
		     TeX-run-TeX nil (context-mode) :help
		     "Run ConTeXt until completion")
		    ("BibTeX" "%(bibtex) %s" TeX-run-BibTeX nil t :help
		     "Run BibTeX")
		    ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
		    ("View" "%V" TeX-run-discard-or-function t t :help
		     "Run Viewer")
		    ("Print" "%p" TeX-run-command t t :help "Print the file")
		    ("Queue" "%q" TeX-run-background nil t :help
		     "View the printer queue" :visible TeX-queue-command)
		    ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t t :help
		     "Generate PostScript file")
		    ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil t :help
		     "Convert DVI file to PostScript")
		    ("Dvipdfmx" "dvipdfmx %d" TeX-run-dvipdfmx nil t :help
		     "Convert DVI file to PDF with dvipdfmx")
		    ("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t :help
		     "Convert PostScript file to PDF")
		    ("Glossaries" "makeglossaries %s" TeX-run-command nil t
		     :help "Run makeglossaries to create glossary file")
		    ("Index" "%(makeindex) %s" TeX-run-index nil t :help
		     "Run makeindex to create index file")
		    ("upMendex" "upmendex %s" TeX-run-index t t :help
		     "Run upmendex to create index file")
		    ("Xindy" "texindy %s" TeX-run-command nil t :help
		     "Run xindy to create index file")
		    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode)
		     :help "Check LaTeX file for correctness")
		    ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode)
		     :help "Check LaTeX file for common mistakes")
		    ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil
		     t :help "Spell-check the document")
		    ("Clean" "TeX-clean" TeX-run-function nil t :help
		     "Delete generated intermediate files")
		    ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help
		     "Delete generated intermediate and output files")
		    ("Other" "" TeX-run-command t t :help
		     "Run an arbitrary command")
		    )
 )