X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch.el;h=1adea9c2c7d6fccf9e863d026745971185c3859b;hb=435cd249a014b37ecfedf4d38a3a6b6471c2730a;hp=6c0bc1bcae0ed9e3f423e9ccdb860484b4e18111;hpb=5e26d14536398210869a920f8e7bb84fd2ace6aa;p=notmuch diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 6c0bc1bc..1adea9c2 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"