Permalink
Browse files

* mu: allow 'recip:' in queries as a shortcut for "to:foo OR cc:foo O…

…R bcc:foo"
  • Loading branch information...
1 parent 9bf8edf commit 412de6f4aa3715ec72b1137f9cd2079266ac13fa @djcb committed Oct 25, 2012
Showing with 32 additions and 12 deletions.
  1. +6 −0 NEWS
  2. +4 −0 lib/mu-msg-fields.h
  3. +9 −2 lib/mu-query.cc
  4. +5 −2 lib/mu-str.c
  5. +8 −8 man/mu-find.1
View
6 NEWS
@@ -9,6 +9,7 @@
- add 'mu script' command to run mu script, for example to do statistics on
your message corpus
- allow 'contact:' as a shortcut in queries for 'from:foo OR to:foo OR
+ cc:foo OR bcc:foo', and 'recip:' as a shortcut for 'to:foo OR
cc:foo OR bcc:foo'
*** mu4e
@@ -23,6 +24,11 @@
message view. Thanks to Abdó Roig-Maranges. New field ":tags".
- automatically update the headers buffer when new messages are found during
indexing; set `mu4e-headers-auto-update' to nil to disable this.
+ - update mail/index with M-x mu4e-update-mail-and-index; which everywhere in
+ mu4e is available with key C-S-u. Use prefix argument to run in
+ background.
+ - add function `mu4e-update-index' to only update the index
+
* Old news
:PROPERTIES:
View
@@ -67,6 +67,10 @@ static const MuMsgFieldId MU_MSG_FIELD_ID_NONE = (MuMsgFieldId)-1;
* in mu-query.cc and mu-str.c */
#define MU_MSG_FIELD_PSEUDO_CONTACT "contact"
+/* this is a shortcut for To/Cc/Bcc in queries; handled specially in
+ * mu-query.cc and mu-str.c */
+#define MU_MSG_FIELD_PSEUDO_RECIP "recip"
+
#define mu_msg_field_id_is_valid(MFID) \
((MFID) < MU_MSG_FIELD_ID_NUM)
View
@@ -187,8 +187,7 @@ struct _MuQuery {
void add_special_prefixes () {
char pfx[] = { '\0', '\0' };
- /* add 'contact' as a shortcut for
- * From/Cc/Bcc/To: */
+ /* add 'contact' as a shortcut for From/Cc/Bcc/To: */
pfx[0] = mu_msg_field_xapian_prefix(MU_MSG_FIELD_ID_FROM);
_qparser.add_prefix (MU_MSG_FIELD_PSEUDO_CONTACT, pfx);
pfx[0] = mu_msg_field_xapian_prefix(MU_MSG_FIELD_ID_TO);
@@ -197,6 +196,14 @@ struct _MuQuery {
_qparser.add_prefix (MU_MSG_FIELD_PSEUDO_CONTACT, pfx);
pfx[0] = mu_msg_field_xapian_prefix(MU_MSG_FIELD_ID_BCC);
_qparser.add_prefix (MU_MSG_FIELD_PSEUDO_CONTACT, pfx);
+
+ /* add 'recip' as a shortcut for Cc/Bcc/To: */
+ pfx[0] = mu_msg_field_xapian_prefix(MU_MSG_FIELD_ID_TO);
+ _qparser.add_prefix (MU_MSG_FIELD_PSEUDO_RECIP, pfx);
+ pfx[0] = mu_msg_field_xapian_prefix(MU_MSG_FIELD_ID_CC);
+ _qparser.add_prefix (MU_MSG_FIELD_PSEUDO_RECIP, pfx);
+ pfx[0] = mu_msg_field_xapian_prefix(MU_MSG_FIELD_ID_BCC);
+ _qparser.add_prefix (MU_MSG_FIELD_PSEUDO_RECIP, pfx);
}
Xapian::QueryParser _qparser;
View
@@ -439,8 +439,11 @@ check_for_field (const char *str, gboolean *is_field,
&pfx);
/* also check special prefixes... */
if (!pfx.match)
- pfx.match = g_str_has_prefix
- (str, MU_MSG_FIELD_PSEUDO_CONTACT ":");
+ pfx.match =
+ g_str_has_prefix
+ (str, MU_MSG_FIELD_PSEUDO_CONTACT ":") ||
+ g_str_has_prefix
+ (str, MU_MSG_FIELD_PSEUDO_RECIP ":");
*is_field = pfx.match;
*is_range_field = pfx.range_field;
View
@@ -119,14 +119,14 @@ search fields and their abbreviations:
tag,x Tags for the message (\fIX-Label\fR and/or \fIX-Keywords\fR)
.fi
-There is also the special field \fBcontact\fR, which matches all
-contact-fields (\fBfrom\fR, \fBto\fR, \fBcc\fR and \fBbcc\fR).
-
-The meaning of most of these fields should be clear, but some require some
-extra discusion.
-
-First, the message flags field describes certain properties of the message, as
-listed in the following table:
+There are also the special fields \fBcontact\fR, which matches all
+contact-fields (\fBfrom\fR, \fBto\fR, \fBcc\fR and \fBbcc\fR), and
+\fBrecip\fR, which matches all recipient-fields (\fBto\fR, \fBcc\fR and
+\fBbcc\fR).
+
+The meaning of most of the above fields should be clear, but some require some
+extra discusion. First, the message flags field describes certain properties
+of the message, as listed in the following table:
.nf
d,draft Draft Message

0 comments on commit 412de6f

Please sign in to comment.