X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-lib.el;h=c7bb2091f8edcc457ed2f36569ce9bf744c90253;hb=03366a3c5aa313de41bddd61dedc5b5c002e0469;hp=6130309ab73aa425387517c9ae2fbcf246946b4b;hpb=9ca1f945d9f5030600dc14ffff10d4dad14db4ca;p=notmuch diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index 6130309a..c7bb2091 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -23,6 +23,7 @@ (require 'cl-lib) (require 'pcase) +(require 'subr-x) (require 'mm-util) (require 'mm-view) @@ -284,7 +285,7 @@ depending on the value of `notmuch-poll-script'." (interactive) (message "Polling mail...") (if (stringp notmuch-poll-script) - (unless (string= notmuch-poll-script "") + (unless (string-empty-p notmuch-poll-script) (unless (equal (call-process notmuch-poll-script nil nil) 0) (error "Notmuch: poll script `%s' failed!" notmuch-poll-script))) (notmuch-call-notmuch-process "new")) @@ -551,16 +552,19 @@ This replaces spaces, percents, and double quotes in STR with ;;; MML Utilities (defun notmuch-match-content-type (t1 t2) - "Return t if t1 and t2 are matching content types, taking wildcards into account." - (let ((st1 (split-string t1 "/")) - (st2 (split-string t2 "/"))) - (if (or (string= (cadr st1) "*") - (string= (cadr st2) "*")) - ;; Comparison of content types should be case insensitive. - (string= (downcase (car st1)) - (downcase (car st2))) - (string= (downcase t1) - (downcase t2))))) + "Return t if t1 and t2 are matching content types. +Take wildcards into account." + (and (stringp t1) + (stringp t2) + (let ((st1 (split-string t1 "/")) + (st2 (split-string t2 "/"))) + (if (or (string= (cadr st1) "*") + (string= (cadr st2) "*")) + ;; Comparison of content types should be case insensitive. + (string= (downcase (car st1)) + (downcase (car st2))) + (string= (downcase t1) + (downcase t2)))))) (defvar notmuch-multipart/alternative-discouraged '(;; Avoid HTML parts.