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

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

bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.


From: Juri Linkov
Subject: bug#18132: Time for a smarter dired-guess-shell-alist-default? (dired-x.el)
Date: Thu, 07 Dec 2023 19:33:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> 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.

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

reply via email to

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