Subject: Re: bug#39927: 12.2; preview-latex gs treatment off by one

From: Ikumi Keita <[email-masked]>
Date: Thu, 07 Jan 2021 21:17:10 +0900

Hi Itaï, Luke, Braun,

Sorry for late response. It seems that I managed to fix the bug of
preview-latex you reported before. I don't speak Postscript and the fix
is totally heuristic, but it simply works, at least for me.

The attached patch removes a newline in the middle of initial string
sent to ghostscript. This newline was interpreted as a delimeter as
ghostscript, thus ghostscript responded twice to the initial string, if
my speculation is right, which led to a spurious prompt from
ghostscript.

Could you please test whether this patch fixes the problem on your side
if possible?

Best regards,
Ikumi Keita

diff --git a/preview.el.in b/preview.el.in
index eb40ae56..90b9b382 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -1166,7 +1166,7 @@ NONREL is not NIL."
     (setq preview-gs-init-string
           ;; Add commands for revised file access controls introduced
           ;; after gs 9.27 (bug#37719)
-          (concat (format "systemdict /.addcontrolpath known {%s} if\n"
+          (concat (format "systemdict /.addcontrolpath known {%s} if "
                           (mapconcat (lambda (f)
                                        (format "/PermitFileReading %s .addcontrolpath"
                                                (preview-ps-quote-filename f)))