From bc0aca059dbfe8cd485d9591f36efb70a2a6272e Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Wed, 21 Jul 2021 13:04:06 +0200 Subject: [PATCH] Fix dired-guess-default logic after previous change * lisp/dired-x.el (dired-guess-default): Restore previous logic -- require matches for all files (bug#48071). --- lisp/dired-x.el | 7 ++++--- test/lisp/dired-x-tests.el | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 2d91b5a9e8d..073923e09c9 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el @@ -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)))) diff --git a/test/lisp/dired-x-tests.el b/test/lisp/dired-x-tests.el index 98754b19b4e..003923d60fa 100644 --- a/test/lisp/dired-x-tests.el +++ b/test/lisp/dired-x-tests.el @@ -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 -- 2.39.2