X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch.el;h=f6bf9c84d6a9cc4c86c647237d668e5a60784daf;hb=c2d8236b56e713ae2e7053c9ea3cc13f7d1283c4;hp=8aa01049e9be7ddd312f02e756850a9f29ab1aa0;hpb=ec020894331b0ef9b594cdc47f4b79abeda4f9cd;p=notmuch diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 8aa01049..f6bf9c84 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -428,14 +428,16 @@ matched and unmatched messages in the current thread." "Return the stable query for the current region. If ONLY-MATCHED is non-nil, include only matched messages. If it -is nil, include both matched and unmatched messages." +is nil, include both matched and unmatched messages. If there are +no messages in the region then return nil." (let ((query-list nil) (all (not only-matched))) (dolist (queries (notmuch-search-properties-in-region :query beg end)) (when (first queries) (push (first queries) query-list)) (when (and all (second queries)) (push (second queries) query-list))) - (concat "(" (mapconcat 'identity query-list ") or (") ")"))) + (when query-list + (concat "(" (mapconcat 'identity query-list ") or (") ")")))) (defun notmuch-search-find-authors () "Return the authors for the current thread"