]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix bogus future history entries for `M-x grep'
authorLars Ingebrigtsen <larsi@gnus.org>
Tue, 17 May 2022 19:00:25 +0000 (21:00 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 17 May 2022 19:00:25 +0000 (21:00 +0200)
* 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

index b65f7c25b83e158ba2f76655398834acee5907d5..8ba7f1bec3d792e34e53c982f12c45f4840cb5ee 100644 (file)
@@ -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