From f719250f77cf3aa7a9cdf02011375f9d1e7a3775 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Tue, 17 May 2022 21:00:25 +0200 Subject: [PATCH] Fix bogus future history entries for `M-x grep' * lisp/net/mailcap.el (mailcap-file-default-commands): If we have no matching MIME types, don't iterate over (nil) (bug#27236). This fixes things like: (mailcap-file-default-commands '("grep --color=auto -nH --null '' ")) => ("/usr/bin/emacs -nw") --- lisp/net/mailcap.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el index b65f7c25b83..8ba7f1bec3d 100644 --- a/lisp/net/mailcap.el +++ b/lisp/net/mailcap.el @@ -1098,11 +1098,12 @@ For instance, `image/png' will result in `png'." (mailcap-parse-mimetypes) (let* ((all-mime-type ;; All unique MIME types from file extensions - (delete-dups - (mapcar (lambda (file) - (mailcap-extension-to-mime - (file-name-extension file t))) - files))) + (delq nil + (delete-dups + (mapcar (lambda (file) + (mailcap-extension-to-mime + (file-name-extension file t))) + files)))) (all-mime-info ;; All MIME info lists (delete-dups -- 2.39.2