]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix dired-guess-default logic after previous change
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 21 Jul 2021 11:04:06 +0000 (13:04 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 21 Jul 2021 11:04:06 +0000 (13:04 +0200)
* lisp/dired-x.el (dired-guess-default): Restore previous logic --
require matches for all files (bug#48071).

lisp/dired-x.el
test/lisp/dired-x-tests.el

index 2d91b5a9e8d5dad170c40fad629b08d8ccdeb8f4..073923e09c9ada0884ff4d0fb8db2ef5849f34a5 100644 (file)
@@ -979,9 +979,10 @@ See `dired-guess-shell-alist-user'."
             #'append
             (mapcar #'cdr
                     (seq-filter (lambda (elem)
-                                  (seq-some (lambda (file)
-                                              (string-match-p (car elem) file))
-                                            files))
+                                  (seq-every-p
+                                   (lambda (file)
+                                     (string-match-p (car elem) file))
+                                   files))
                                 (append dired-guess-shell-alist-user
                                         dired-guess-shell-alist-default)))
             nil))))
index 98754b19b4e6380b7488566952d7d0dd6ef47f10..003923d60fae119db70bd633d53c4e6a28384251 100644 (file)
@@ -58,8 +58,9 @@
            ("\\.jpe?g\\'" "xloadimage"))))
     (should (equal (dired-guess-default '("/tmp/foo.png")) "display"))
     (should (equal (dired-guess-default '("/tmp/foo.gif"))
-                   '("display" "xloadimage" "feh")))))
-
+                   '("display" "xloadimage" "feh")))
+    (should (equal (dired-guess-default '("/tmp/foo.png" "/tmp/foo.txt"))
+                   nil))))
 
 (provide 'dired-x-tests)
 ;; dired-x-tests.el ends here