]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve the default value of 'doc-view-ghostscript-program'.
authorTassilo Horn <tsdh@gnu.org>
Wed, 22 Apr 2020 17:23:23 +0000 (19:23 +0200)
committerTassilo Horn <tsdh@gnu.org>
Wed, 22 Apr 2020 17:24:51 +0000 (19:24 +0200)
* lisp/doc-view.el (doc-view-ghostscript-program): On Windows, try
gswin64c, gswin32c, rungs, and mgs.  (Bug#36357)

lisp/doc-view.el

index 3788d79725887ffa2437cf649feb2434ea135ddf..8dd0d93071eedd09d165113f9c9d3a83287a59ef 100644 (file)
 (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")