summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJani Nikula <jani@nikula.org>2016-02-21 13:29:17 +0200
committerJani Nikula <jani@nikula.org>2016-02-21 13:29:17 +0200
commitcc1ab73f3db610334ce8ab8809b6984fc1650efe (patch)
treeac3578be9cf039f92fad9d136de15f0ff3c0d8e0
parent3321ebc8d3f4aa634965bc97c3d286a329bafc7a (diff)
faq: how do I search for messages that have no tags
-rw-r--r--faq.mdwn15
1 files changed, 15 insertions, 0 deletions
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 /')