On 2022-02-22 19:01:34 -0800, Kevin J. McCarthy wrote:
>   - #389 requests ~C to scan Bcc headers too (presumably for searching
> the "sent" folder).  It might also be worth adding to other patterns
> such as ~L.

FYI, in 2008, I wrote a patch to search for an address in
h->env->from, h->env->sender, h->env->to, h->env->cc, h->env->bcc,
h->env->return_path, h->env->reply_to, h->env->mail_followup_to.
I'm using ~a for that (as "all addresses").

I've attached the current version.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
diff --git a/PATCHES b/PATCHES
index e69de29b..98189c1e 100644
--- a/PATCHES
+++ b/PATCHES
@@ -0,0 +1 @@
+patch-20201129.vl.address_all_patt.1
diff --git a/doc/manual.xml.head b/doc/manual.xml.head
index 53c94ed9..77637bc6 100644
--- a/doc/manual.xml.head
+++ b/doc/manual.xml.head
@@ -5769,6 +5769,8 @@ shows several ways to select messages.
 <row><entry>Pattern modifier</entry><entry>Description</entry></row>
 </thead>
 <tbody>
+<row><entry>~a <emphasis>EXPR</emphasis></entry><entry>messages which contain 
EXPR in some envelope address field</entry></row>
+<row><entry>%a <emphasis>GROUP</emphasis></entry><entry>messages which contain 
a member of GROUP in some envelope address field</entry></row>
 <row><entry>~A</entry><entry>all messages</entry></row>
 <row><entry>~b <emphasis>EXPR</emphasis></entry><entry>messages which contain 
<emphasis>EXPR</emphasis> in the message body ***)</entry></row>
 <row><entry>=b <emphasis>STRING</emphasis></entry><entry>If IMAP is enabled, 
like ~b but searches for <emphasis>STRING</emphasis> on the server, rather than 
downloading each message and searching it locally.</entry></row>
diff --git a/mutt.h b/mutt.h
index 7b719cec..b6356e4b 100644
--- a/mutt.h
+++ b/mutt.h
@@ -269,6 +269,7 @@ enum
   MUTT_PERSONAL_RECIP,
   MUTT_PERSONAL_FROM,
   MUTT_ADDRESS,
+  MUTT_ADDRESS_ALL,
   MUTT_CRYPT_SIGN,
   MUTT_CRYPT_VERIFIED,
   MUTT_CRYPT_ENCRYPT,
diff --git a/pattern.c b/pattern.c
index 6957a7e8..771029bb 100644
--- a/pattern.c
+++ b/pattern.c
@@ -64,6 +64,11 @@ static const struct pattern_flags
 }
 Flags[] =
 {
+  { 'a', MUTT_ADDRESS_ALL, 0, EAT_REGEXP,
+    /* L10N:
+       Pattern Completion Menu description for ~a
+    */
+    N_("messages with an address from headers matching EXPR") },
   { 'A', MUTT_ALL, 0, 0,
     /* L10N:
        Pattern Completion Menu description for ~A
@@ -1676,6 +1681,12 @@ mutt_pattern_exec (struct pattern_t *pat, 
pattern_exec_flag flags, CONTEXT *ctx,
       return (pat->not ^ match_adrlist (pat, flags & MUTT_MATCH_FULL_ADDRESS, 
4,
                                         h->env->from, h->env->sender,
                                         h->env->to, h->env->cc));
+    case MUTT_ADDRESS_ALL:
+      return (pat->not ^ match_adrlist (pat, flags & MUTT_MATCH_FULL_ADDRESS, 
8,
+                                        h->env->from, h->env->sender,
+                                        h->env->to, h->env->cc, h->env->bcc,
+                                        h->env->return_path, h->env->reply_to,
+                                        h->env->mail_followup_to));
     case MUTT_RECIPIENT:
       return (pat->not ^ match_adrlist (pat, flags & MUTT_MATCH_FULL_ADDRESS,
                                         2, h->env->to, h->env->cc));

Reply via email to