X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-lib.el;h=c7bb2091f8edcc457ed2f36569ce9bf744c90253;hb=b860be6a765b421f755a7c1b054f6b9a39b129c0;hp=cbac88593c2fe56c431a455bc545eea39e538d08;hpb=f47e3333b5478e43840e55710311aebdd441fc0e;p=notmuch diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el index cbac8859..c7bb2091 100644 --- a/emacs/notmuch-lib.el +++ b/emacs/notmuch-lib.el @@ -22,6 +22,8 @@ ;;; Code: (require 'cl-lib) +(require 'pcase) +(require 'subr-x) (require 'mm-util) (require 'mm-view) @@ -283,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")) @@ -550,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.