X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=faq.mdwn;h=c2a878442d2c5a1b425907a0ca26e4829dd520e8;hb=0c99e1bff4334dfb6df4eebe5e72d217366207b6;hp=d6112132148a0c9682c702b73c2ff4c3c9669a7b;hpb=fa6a1c33a3f78d16cbcc15f3b17a00abdf801a32;p=notmuch-wiki diff --git a/faq.mdwn b/faq.mdwn index d611213..c2a8784 100644 --- a/faq.mdwn +++ b/faq.mdwn @@ -26,3 +26,18 @@ See [[excluding]]. (setq message-citation-line-function 'message-insert-formatted-citation-line) See help for `message-citation-line-format` for details. + +## How do I search for messages that have no tags? + +Unfortunately, there is no way to do this directly. + +However, it's possible to accomplish this using two searches in shell. First, +you need to query all tags in the database, and transform the result into a +query that matches messages that have none of those tags: + + $ notmuch search --output=tags \* | sed 's/^/not tag:/;2~1s/^/and /' + +Next, use that to query the messages: + + $ notmuch search $(notmuch search --output=tags \* | \ + sed 's/^/not tag:/;2~1s/^/and /')