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: Eli Zaretskii <eliz <at> gnu.org>
Cc: arash <at> gnu.org, mrsebastianurban <at> gmail.com, 36357-done <at> debbugs.gnu.org
Subject: bug#36357: Wrong Ghostscript program name on MS Win
Date: Wed, 22 Apr 2020 19:29:30 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Tassilo Horn <tsdh <at> gnu.org>
>> Cc: arash <at> gnu.org,  mrsebastianurban <at> gmail.com,  36357 <at> debbugs.gnu.org
>> Date: Wed, 22 Apr 2020 16:14:41 +0200
>> 
>> > It is IME wrong and user-unfriendly to refuse to load foo.bat or
>> > foo.cmd and insist on running foo.exe.  The reason is that having a
>> > batch file that shadows a .exe program is the easiest way of
>> > "customizing" programs, like adding default arguments, setting up a
>> > special PATH value, etc.
>> 
>> I agree, and I will omit the extension at least for gs{64,32}winc.  The
>> question is more how likely it is that some user has her own "rungs"
>> command/batch script which has nothing to do with "running GhostScript"
>> and then we call it in doc-view.  I mean, "rungs" is at least an English
>> word...
>
> I think it's unlikely.  E.g., on my system there's not a single file
> that goes by the name "rungs" with any extension.  Another data point
> is that package authors generally try to choose names for their
> programs that don't clash with existing popular programs.  So I think
> you could stop worrying about this.

Ok, thank you all, that's the patch I've eventually pushed to emacs-27.

--8<---------------cut here---------------start------------->8---
@@ -155,9 +155,21 @@ doc-view
 (defcustom doc-view-ghostscript-program
   (cond
    ((memq system-type '(windows-nt ms-dos))
-    "gswin32c")
-   (t
-    "gs"))
+    (or
+     ;; 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))))
+   (t "gs"))
   "Program to convert PS and PDF files to PNG."
   :type 'file
   :version "27.1")
--8<---------------cut here---------------end--------------->8---

Eli, I guess some brave soul merges from emacs-27 to master from time to
time, so there's nothing more I have to do, right?

Bye,
Tassilo




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

Previous Next


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