Hi all,

Steps to reproduce:

- Emacs -Q, recent master.
- AUCTeX main branch.
- Visit a minimal TeX file, e.g.:

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\begin{document}
Let $x$ and $y$.
\end{document}
--8<---------------cut here---------------end--------------->8---

- Disable TeX-PDF-mode.
- Ensure preview-image-type is not dvi* (e.g., use the default, png).
- M-x preview-buffer (C-c C-p C-b).

This gives the backtrace:

Debugger entered--Lisp error: (file-missing "Opening input file" "No such file 
or directory" "~/doit/_region_.prv/tmpGUZRjz/pr1-1.png")
  preview-reraise-error()
  preview-gs-filter(#<process Preview-Ghostscript> "GS>")

>From *_region_ output*:

Preview-DviPS finished at Tue Feb 17 12:20:35
Running `Preview-Ghostscript' with ``/Library/TeX/texbin/rungs 
-sOutputFile\=_region_.prv/tmpGUZRjz/pr1-\%d.png -q -dDELAYSAFER -dNOPAUSE 
-DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 
-sDEVICE\=png16m -r153.109x153.361''
Ghostscript filter: Opening input file: No such file or directory, 
~/doit/_region_.prv/tmpGUZRjz/pr1-1.png

This regression seems to have been introduced in
1925629dbe811452deeab45b98e290936bec9555 in
preview-dvi*-process-setup-1, where the PS-FILE slot is hardcoded to t.
That seems correct for dvi*, but not for dvips+gs, where this slot
previously held preview-ps-file (after running preview-start-dvips).
The attached patch restores that behavior while keeping the dvi* path
unchanged.  Any thoughts?

Thanks, best,

Paul

>From 2d068fd5cd01c2b40ec143d90fbdfe0590cc9f90 Mon Sep 17 00:00:00 2001
From: Paul Nelson <[email protected]>
Date: Tue, 17 Feb 2026 11:13:44 +0100
Subject: [PATCH] preview.el: Pass correct ps-file in gs/dvips setup

* preview.el (preview-dvi*-process-setup-1): Add PS-FILE
argument.
(preview-gs-dvips-process-setup): Pass 'preview-ps-file as
PS-FILE argument.
(preview-dvi*-process-setup): Pass t as PS-FILE argument.
---
 preview.el | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/preview.el b/preview.el
index 8b757c84..0b3dd9ab 100644
--- a/preview.el
+++ b/preview.el
@@ -933,10 +933,11 @@ Pure borderless black-on-white will return an empty string."
   "Check if IMAGETYPE is supported."
   (image-type-available-p imagetype))
 
-(defun preview-dvi*-process-setup-1 (img-type start sentinel)
+(defun preview-dvi*-process-setup-1 (img-type start sentinel ps-file)
   "Setup process of a DVI converter to IMG-TYPE.
 START is the function that actually starts the process with
-`TeX-sentinel-function' set to SENTINEL."
+`TeX-sentinel-function' set to SENTINEL.
+PS-FILE is a symbol that is evaluated after START has run."
   (setq preview-gs-command-line (append
                                  preview-gs-command-line
                                  (list (preview-gs-resolution
@@ -953,7 +954,8 @@ START is the function that actually starts the process with
     (setq TeX-sentinel-function sentinel)
     (list (funcall start)
           (current-buffer)
-          TeX-active-tempdir t
+          TeX-active-tempdir
+          (symbol-value ps-file)
           img-type)))
 
 (defun preview-gs-dvips-process-setup ()
@@ -962,14 +964,16 @@ START is the function that actually starts the process with
    preview-gs-image-type
    (lambda ()
      (preview-start-dvips preview-fast-conversion))
-   #'preview-gs-dvips-sentinel))
+   #'preview-gs-dvips-sentinel
+   'preview-ps-file))
 
 (defun preview-dvi*-process-setup ()
   "Set up dvi conversion process."
   (preview-dvi*-process-setup-1
    preview-dvi*-image-type
    #'preview-start-dvi*
-   #'preview-dvi*-sentinel))
+   #'preview-dvi*-sentinel
+   t))
 (define-obsolete-function-alias
   'preview-dvipng-process-setup #'preview-dvi*-process-setup "14.2.0")
 
-- 
2.50.1 (Apple Git-155)

_______________________________________________
bug-auctex mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-auctex

Reply via email to