From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs Subject: bug#36357: Wrong Ghostscript program name on MS Win Date: Wed, 22 Apr 2020 11:05:24 +0200 Message-ID: <87368vevqj.fsf@gnu.org> References: <90d6e546-8058-1cb3-1d2c-da31f9af0edc@gmail.com> <4291e1bb-c061-39bc-818a-7243544ec52b@gmail.com> <86y2qpj2nv.fsf@gnu.org> <86d0817zdd.fsf@gnu.org> <3f0dcce2-8837-4ef9-8981-3aa5864ca15f@beta.fastmail.com> <868sip7yyi.fsf@gnu.org> <86sggwwpjw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="74135"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Sebastian Urban , 36357@debbugs.gnu.org To: Arash Esbati Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 22 11:06:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jRBKe-000JB9-A1 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Apr 2020 11:06:12 +0200 Original-Received: from localhost ([::1]:46360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRBKd-0001y6-Cq for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Apr 2020 05:06:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37050) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRBKV-0001xm-J4 for bug-gnu-emacs@gnu.org; Wed, 22 Apr 2020 05:06:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jRBKV-0000lG-73 for bug-gnu-emacs@gnu.org; Wed, 22 Apr 2020 05:06:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39739) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jRBKU-0000kO-Ps for bug-gnu-emacs@gnu.org; Wed, 22 Apr 2020 05:06:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jRBKU-00069e-JO for bug-gnu-emacs@gnu.org; Wed, 22 Apr 2020 05:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tassilo Horn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Apr 2020 09:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36357 X-GNU-PR-Package: emacs Original-Received: via spool by 36357-submit@debbugs.gnu.org id=B36357.158754633923590 (code B ref 36357); Wed, 22 Apr 2020 09:06:02 +0000 Original-Received: (at 36357) by debbugs.gnu.org; 22 Apr 2020 09:05:39 +0000 Original-Received: from localhost ([127.0.0.1]:51274 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRBK6-00068J-Oh for submit@debbugs.gnu.org; Wed, 22 Apr 2020 05:05:39 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jRBK2-00067u-Cv for 36357@debbugs.gnu.org; Wed, 22 Apr 2020 05:05:37 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55628) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jRBJx-0007TO-5y; Wed, 22 Apr 2020 05:05:29 -0400 Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]:46605) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1jRBJv-000790-KH; Wed, 22 Apr 2020 05:05:27 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id F2D4127C0054; Wed, 22 Apr 2020 05:05:26 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Wed, 22 Apr 2020 05:05:26 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrgeejgddtlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufhffjgfkfgggtgesthdtredttdertdenucfhrhhomhepvfgrshhsihhl ohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucffohhmrghinhepmhhikhhtvg igrdhorhhgnecukfhppeekgedrudefvddrleeirddvheegnecuvehluhhsthgvrhfuihii vgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnhdomhgvshhmthhprghuth hhphgvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeehvdelkedqthhsughhpeep ghhnuhdrohhrghesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Original-Received: from thinkpad-t440p (p548460fe.dip0.t-ipconnect.de [84.132.96.254]) by mail.messagingengine.com (Postfix) with ESMTPA id 290923065CB4; Wed, 22 Apr 2020 05:05:26 -0400 (EDT) In-Reply-To: <86sggwwpjw.fsf@gnu.org> (Arash Esbati's message of "Tue, 21 Apr 2020 22:29:23 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:178778 Archived-At: Arash Esbati 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