bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#36357: Wrong Ghostscript program name on MS Win


From: Tassilo Horn
Subject: bug#36357: Wrong Ghostscript program name on MS Win
Date: Wed, 22 Apr 2020 15:00:55 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Sebastian Urban <mrsebastianurban@gmail.com> writes:

>>> 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.
>
> I would say that this is not very "default" (default = normal
> Ghostscript installation) setup, in which case user should set up
> desired setting manually.

Well, if there is no harm in doing so, I don't see a reason not to
support those non-default setups automatically.  And in my opinion,
having a TeX distro and no manual ghostscript install seems not so
uncommon.

> About the code:
>
> 1. There is:
> +   ;; Standard Ghostscript
> +   (executable-find "gs")
> ...
> +   ;; Standard Ghostscript as fallback
> +   "gs")
>
> What for is first "Standard Ghostscript"?  There is no "gs" in
> Windows, and fallback will work for Unix.

The reason is that I wanted to prefer gs over rungs in case both are
installed (like on my GNU/Linux box).

> 2. Version is set to 28.1, so... we are skipping 27.1?  It's not big
> deal for me, but some say: don't put off until tomorrow (28.1) what
> you can do today (27.1).

Yes, that was wrong and a left-over of Arash's patch where he assumed
the change would go only into master instead of emacs-27.

>> 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?
>
> I think it's OK, because "gswin32/64c" is, as I mentioned earlier -
> the default way of setting up GS, and it should have higher priority
> as default, as well as 64bits should be higher than 32bits version,
> because... well, everything moves towards 64bits, so it is more
> up-to-date order.  As for "rungs/mgs" - what is more common "TeX
> Live/MikTeX"?

I think, this doesn't matter.  Nobody has both TeXLive and MikTeX
installed in parallel.

>> 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?
>
> "Falsely setting" file with the same name but different extension
> crossed my mind.  So, yes we should include extension just to be sure,
> that function will find exactly what we are looking for.

Ok.

>> If so, we need the OS distinction again.
>
> What for?

Because I've thought it would be nice to test for (executable-find
"rungs") on any platform but (executable-find "rungs.exe") will of
course work only on Windows.  On the other hand, rungs on non-windows
platforms just calls gs anyway, so we can skip that there.

So if nobody complains, I'll commit the version below later.

--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.exe")
+     (executable-find "gswin32c.exe")
+     ;; The GS wrapper coming with TeX Live
+     (executable-find "rungs.exe")
+     ;; 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.exe")))
+       (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---

Bye,
Tassilo





reply via email to

[Prev in Thread] Current Thread [Next in Thread]