From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el) Date: Thu, 07 Dec 2023 19:33:53 +0200 Organization: LINKOV.NET Message-ID: <86fs0ef372.fsf@mail.linkov.net> References: <83ilxn3qpo.fsf@gnu.org> <878ryizwyi.fsf@mail.linkov.net> <86y1eoxtrr.fsf@mail.linkov.net> <83leaofebt.fsf@gnu.org> <86edgfk37h.fsf@mail.linkov.net> <83zfz3dyae.fsf@gnu.org> <86h6l9zorh.fsf@mail.linkov.net> <838r6kby1m.fsf@gnu.org> <86msuz5cft.fsf@mail.linkov.net> <86ttp6j8ax.fsf@mail.linkov.net> <8334wp93ww.fsf@gnu.org> <86v89lt6mk.fsf@mail.linkov.net> <83leag7loj.fsf@gnu.org> <86o7f8ijnd.fsf@mail.linkov.net> <86y1eb8bi8.fsf@mail.linkov.net> <861qbz9r54.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27756"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: Eli Zaretskii , "18132@debbugs.gnu.org" <18132@debbugs.gnu.org> To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 07 18:35:00 2023 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 1rBIH6-000719-6V for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 07 Dec 2023 18:35:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBIGy-0007L3-VD; Thu, 07 Dec 2023 12:34:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBIGw-0007KN-A6 for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 12:34:50 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBIGv-0003bY-FZ for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 12:34:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rBIH7-0001ec-TX for bug-gnu-emacs@gnu.org; Thu, 07 Dec 2023 12:35:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 07 Dec 2023 17:35: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.17019704716306 (code B ref 18132); Thu, 07 Dec 2023 17:35:01 +0000 Original-Received: (at 18132) by debbugs.gnu.org; 7 Dec 2023 17:34:31 +0000 Original-Received: from localhost ([127.0.0.1]:43055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBIGd-0001dd-3K for submit@debbugs.gnu.org; Thu, 07 Dec 2023 12:34:31 -0500 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:47583) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBIGa-0001cz-Sg for 18132@debbugs.gnu.org; Thu, 07 Dec 2023 12:34:29 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 55BD0240004; Thu, 7 Dec 2023 17:34:08 +0000 (UTC) In-Reply-To: <861qbz9r54.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 06 Dec 2023 19:28:55 +0200") X-GND-Sasl: juri@linkov.net 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275687 Archived-At: --=-=-= Content-Type: text/plain > OK, now pushed. More problems: XDG has much better support for media files than dired-guess-shell-alist-default that contains many old obsolete and random commands for media files. OTOH, dired-guess-shell-alist-default has much better support for non-media files than XDG and mailcap. So currently there is no way to configure shell-command-guess-functions to use only best commands. When shell-command-guess-functions is configured to '(shell-command-guess-xdg shell-command-guess-dired) then images are opened with "xloadimage" that doesn't exist. But when shell-command-guess-functions is configured to '(shell-command-guess-dired shell-command-guess-xdg) then images are opened with the existing program like "display", but then patches can't be applied, because XDG provides for patch files such useless commands as "more" and "less". All this can be fixed by this patch that removes old media commands from 'dired-guess-shell-alist-default'. Then removed commands will not override media commands from shell-command-guess-xdg. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=dired-guess-shell-alist-default.patch diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 0998e76c410..de54968bdbe 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -1216,28 +1216,28 @@ dired-guess-shell-alist-default " " dired-guess-shell-znew-switches)) '("\\.pod\\'" "perldoc" "pod2man * | nroff -man") - '("\\.dvi\\'" "xdvi" "dvips") ; preview and printing - '("\\.au\\'" "play") ; play Sun audiofiles - '("\\.mpe?g\\'\\|\\.avi\\'" "xine -p") - '("\\.ogg\\'" "ogg123") - '("\\.mp3\\'" "mpg123") - '("\\.wav\\'" "play") + ;; '("\\.dvi\\'" "xdvi" "dvips") ; preview and printing + ;; '("\\.au\\'" "play") ; play Sun audiofiles + ;; '("\\.mpe?g\\'\\|\\.avi\\'" "xine -p") + ;; '("\\.ogg\\'" "ogg123") + ;; '("\\.mp3\\'" "mpg123") + ;; '("\\.wav\\'" "play") '("\\.uu\\'" "uudecode") ; for uudecoded files '("\\.hqx\\'" "mcvert") '("\\.sh\\'" "sh") ; execute shell scripts - '("\\.xbm\\'" "bitmap") ; view X11 bitmaps + ;; '("\\.xbm\\'" "bitmap") ; view X11 bitmaps '("\\.gp\\'" "gnuplot") - '("\\.p[bgpn]m\\'" "xloadimage") - '("\\.gif\\'" "xloadimage") ; view gif pictures - '("\\.tif\\'" "xloadimage") - '("\\.png\\'" "display") ; xloadimage 4.1 doesn't grok PNG - '("\\.jpe?g\\'" "xloadimage") + ;; '("\\.p[bgpn]m\\'" "xloadimage") + ;; '("\\.gif\\'" "xloadimage") ; view gif pictures + ;; '("\\.tif\\'" "xloadimage") + ;; '("\\.png\\'" "display") ; xloadimage 4.1 doesn't grok PNG + ;; '("\\.jpe?g\\'" "xloadimage") '("\\.fig\\'" "xfig") ; edit fig pictures '("\\.out\\'" "xgraph") ; for plotting purposes. '("\\.tex\\'" "latex" "tex") '("\\.texi\\(nfo\\)?\\'" "makeinfo" "texi2dvi") - '("\\.pdf\\'" "xpdf") - '("\\.doc\\'" "antiword" "strings") + ;; '("\\.pdf\\'" "xpdf") + ;; '("\\.doc\\'" "antiword" "strings") '("\\.rpm\\'" "rpm -qilp" "rpm -ivh") '("\\.dia\\'" "dia") '("\\.mgp\\'" "mgp") @@ -1320,7 +1320,9 @@ dired-guess-shell-command (if (equal val "") default val)))) (defcustom shell-command-guess-functions - '(shell-command-guess-dired) + '(shell-command-guess-mailcap + shell-command-guess-xdg + shell-command-guess-dired) "List of functions that guess shell commands for files. Each function receives a list of commands and a list of file names and should return the same list of commands with changes --=-=-=--