GNU bug report logs - #36357
Wrong Ghostscript program name on MS Win

Previous Next

Package: emacs;

Reported by: Sebastian Urban <mrsebastianurban <at> gmail.com>

Date: Mon, 24 Jun 2019 16:05:02 UTC

Severity: minor

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Tassilo Horn <tsdh <at> gnu.org>
To: Arash Esbati <arash <at> gnu.org>
Cc: Sebastian Urban <mrsebastianurban <at> gmail.com>, 36357 <at> debbugs.gnu.org
Subject: bug#36357: Wrong Ghostscript program name on MS Win
Date: Wed, 22 Apr 2020 11:05:24 +0200
Arash Esbati <arash <at> gnu.org> writes:

Hi again,

> I tend not to agree here as I've seen people who only have
> TeXlive/MikTeX installed on Windows which cater for a minimal
> Ghostscript.  Those people could benefit from the code above.

I think that's a valid argument.  So that's what I would go for.

--8<---------------cut here---------------start------------->8---
@@ -153,14 +153,27 @@ doc-view
   :prefix "doc-view-")
 
 (defcustom doc-view-ghostscript-program
-  (cond
-   ((memq system-type '(windows-nt ms-dos))
-    "gswin32c")
-   (t
-    "gs"))
+  (or
+   ;; Standard Ghostscript
+   (executable-find "gs")
+   ;; Windows Ghostscript
+   (executable-find "gswin64c")
+   (executable-find "gswin32c")
+   ;; The GS wrapper coming with TeX Live
+   (executable-find "rungs")
+   ;; The MikTeX builtin GS Check if mgs is functional for external
+   ;; non-MikTeX apps.  Was available under:
+   ;; http://blog.miktex.org/post/2005/04/07/Starting-mgsexe-at-the-DOS-Prompt.aspx
+   (when-let ((mgs (executable-find "mgs")))
+     (when (= 0 (shell-command
+                 (concat (shell-quote-argument mgs)
+                         " -q -dNODISPLAY -c quit")))
+       mgs))
+   ;; Standard Ghostscript as fallback
+   "gs")
   "Program to convert PS and PDF files to PNG."
   :type 'file
-  :version "27.1")
+  :version "28.1")
--8<---------------cut here---------------end--------------->8---

We should ask ourselves if the order is ok, i.e., if on systems where
multiple gs installs are available, the "best" one gets selected.  So is
it correct to prefer gswin64c over gswin32c and that over rungs and mgs?

Another question: You both used executable-find with exe file extension.
Was that intended?  I mean, it makes sure we don't falsely set some
"gs.bat" or "gs.cmd" which might have nothing to do with GhostScript.
Is that a real danger?  If so, we need the OS distinction again.

Bye,
Tassilo




This bug report was last modified 5 years and 31 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.