From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el) Date: Sat, 23 Oct 2021 11:34:52 +0300 Message-ID: <83h7d85ec3.fsf@gnu.org> References: <87d2cn67zo.fsf@mail.jurta.org> <87bns6dcul.fsf@mail.jurta.org> <87silbstsc.fsf@mail.jurta.org> <83lf2k5gna.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23646"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 18132@debbugs.gnu.org, rrt@sc3d.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 23 10:36:27 2021 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 1meCVv-0005xn-B8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Oct 2021 10:36:27 +0200 Original-Received: from localhost ([::1]:35340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1meCVs-0004PD-UB for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 23 Oct 2021 04:36:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meCVW-0004On-5b for bug-gnu-emacs@gnu.org; Sat, 23 Oct 2021 04:36:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:51009) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1meCVV-00014F-TI for bug-gnu-emacs@gnu.org; Sat, 23 Oct 2021 04:36:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1meCVV-0008O1-Qj for bug-gnu-emacs@gnu.org; Sat, 23 Oct 2021 04:36:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Oct 2021 08:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18132 X-GNU-PR-Package: emacs Original-Received: via spool by 18132-submit@debbugs.gnu.org id=B18132.163497811932183 (code B ref 18132); Sat, 23 Oct 2021 08:36:01 +0000 Original-Received: (at 18132) by debbugs.gnu.org; 23 Oct 2021 08:35:19 +0000 Original-Received: from localhost ([127.0.0.1]:34322 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meCUo-0008N1-Id for submit@debbugs.gnu.org; Sat, 23 Oct 2021 04:35:19 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52824) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1meCUl-0008Ml-TT for 18132@debbugs.gnu.org; Sat, 23 Oct 2021 04:35:16 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55150) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1meCUf-0000fk-TU; Sat, 23 Oct 2021 04:35:09 -0400 Original-Received: from [87.69.77.57] (port=2203 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1meCUc-0004cA-M5; Sat, 23 Oct 2021 04:35:09 -0400 In-Reply-To: (message from Stefan Kangas on Sat, 23 Oct 2021 01:16:48 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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:217959 Archived-At: > From: Stefan Kangas > Date: Sat, 23 Oct 2021 01:16:48 -0700 > Cc: rrt@sc3d.org, 18132@debbugs.gnu.org > > Eli Zaretskii writes: > > > It's not only that. Emacs's ability to run programs given a file can > > extend and surpass those of the underlying OS, and the ability of > > Emacs users to configure and customize that in a unified > > system-independent manner are either better or simply not available at > > all in the OS-level tools which offer similar functionality. > > > > So I think it would be nice to extend dired-guess-shell-* so that it > > could delegate to the OS-level capabilities like xdg-open or > > w32-shell-execute, but we should preserve the abilities to override or > > extend that with Emacs-level associations between files and programs. > > That sounds like exactly the right thing to do. So we need to add stuff > here, without taking anything away. Yes, that's the idea. > However, I will add that while we maintain our current capabilities for > customization, we might want to consider removing or updating some > entries from `dired-guess-shell-alist-default'. For example, we > currently recommend xpdf for PDF:s, which, sure, is presumably available > "everywhere", but also is pretty lacking in features and just plain > clunky compared to something like evince. > > To make matters even worse, > > emacs -Q --eval "(progn (require 'dired-x) (dired \"~\"))" > > happily offers up xpdf as the default command for PDF:s even though I > don't even have xpdf installed! So perhaps it's not that ubiquitous > these days... you have to specifically install it to even have it. I think that's a separate issue: how to deal with a failure to invoke the program which we guessed would be appropriate for the file in question. I could argue that we should try invoking the program anyway, because failure to invoke it could mean the user should install some component, and that is useful information for the user. > Looking even more closely at this, I guess `xdg-open' could be used as > some final fallback, but it doesn't seem to add anything that isn't > already available from mailcap? And we already have > `mailcap-file-default-commands', so why not just provide a default based > on that? Because that's not portable enough? > On my machine, I get the very reasonable: > > (mailcap-file-default-commands '("foo.pdf")) > => ("evince" "xdg-open") Here, the above returns something much less useful: ("pdftotext ? -" "gv -safer") None of that would have helped me to view a PDF file. So if we want to use mailcap for this, we'd need to extend that, and make it smarter, in particular on non-GNU/Linux platforms. More generally, I'm not sure mailcap is the right tool for the job: its main purpose is to view attachments to email messages, where we generally have metadata (MIME etc.) which is not necessarily available for arbitrary disk files.