[PATCH v4 5/7] Introduce _notmuch_message_has_term()
[notmuch-archives.git] / 2a / 1d5c2165430357c6bfd98fdae1e6930e69ee80
1 Return-Path: <bergey@alum.mit.edu>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id BC6FB431FBD\r
6         for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 16:15:51 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id Cv8QOG6t--a8 for <notmuch@notmuchmail.org>;\r
17         Sun, 18 Nov 2012 16:15:47 -0800 (PST)\r
18 X-Greylist: delayed 414 seconds by postgrey-1.32 at olra;\r
19         Sun, 18 Nov 2012 16:15:47 PST\r
20 Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com\r
21         [66.111.4.28])\r
22         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
23         (No client certificate requested)\r
24         by olra.theworths.org (Postfix) with ESMTPS id D15D0431FB6\r
25         for <notmuch@notmuchmail.org>; Sun, 18 Nov 2012 16:15:47 -0800 (PST)\r
26 Received: from compute5.internal (compute5.nyi.mail.srv.osa [10.202.2.45])\r
27         by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id 2C3DD207B0;\r
28         Sun, 18 Nov 2012 19:08:51 -0500 (EST)\r
29 Received: from frontend2.nyi.mail.srv.osa ([10.202.2.161])\r
30         by compute5.internal (MEProxy); Sun, 18 Nov 2012 19:08:51 -0500\r
31 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=\r
32         messagingengine.com; h=from:to:subject:in-reply-to:references\r
33         :date:message-id:mime-version:content-type; s=smtpout; bh=rKazuH\r
34         XK+WKxURGcsUm5HA1eoqM=; b=Be4nohlfPjHE4g4wL3XGJGZVnSaIuAXgE6efYv\r
35         dufsPEWPGHrnGEt2RW6ghEgxk1xjwoRHTapWwsmLcKJDMRk4/301ccjBit05peMB\r
36         BFBD/ctGQK6D++Eweqs9i52DuvEkTYdpTwsizx9tsuUpIAETz6ejfVgXgk5FEUyN\r
37         5/pUY=\r
38 X-Sasl-enc: tDSlzH6XPZe9L+BIKs5T19fWzHuD4ABVuDkpS1VkWShY 1353283730\r
39 Received: from localhost (unknown [66.80.90.109])\r
40         by mail.messagingengine.com (Postfix) with ESMTPA id D92E748263D;\r
41         Sun, 18 Nov 2012 19:08:50 -0500 (EST)\r
42 From: Daniel Bergey <bergey@alum.mit.edu>\r
43 To: Notmuch Mail List <notmuch@notmuchmail.org>,\r
44         Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
45 Subject: Re: [PATCH] emacs: functions to import sender or recipient into BBDB\r
46 In-Reply-To: <87ipa66pne.fsf@betacantrips.com>\r
47 References: <87lii62sk2.fsf@wonderlust.lan> <87ipa66pne.fsf@betacantrips.com>\r
48 User-Agent: Notmuch/0.14 (http://notmuchmail.org) Emacs/24.2.1\r
49         (i486-pc-linux-gnu)\r
50 Date: Sun, 18 Nov 2012 19:08:49 -0500\r
51 Message-ID: <87ip92zc6m.fsf@wonderlust.lan>\r
52 MIME-Version: 1.0\r
53 Content-Type: text/plain\r
54 X-BeenThere: notmuch@notmuchmail.org\r
55 X-Mailman-Version: 2.1.13\r
56 Precedence: list\r
57 List-Id: "Use and development of the notmuch mail system."\r
58         <notmuch.notmuchmail.org>\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
60         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
62 List-Post: <mailto:notmuch@notmuchmail.org>\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
66 X-List-Received-Date: Mon, 19 Nov 2012 00:15:52 -0000\r
67 \r
68 On 2012-10-19 at 18:52, Ethan Glasser-Camp <ethan.glasser.camp@gmail.com> wrote:\r
69 > Daniel Bergey <bergey@alum.mit.edu> writes:\r
70 >\r
71 >> From a show buffer, bbdb/notmuch-snarf-from imports the sender into\r
72 >> bbdb.  bbdb/notmuch-snarf-to attempts to import all recipients.  BBDB\r
73 >> displays a buffer with each contact; C-g displays the next contact, or\r
74 >> returns to the notmuch-show buffer.\r
75 >>\r
76 >> This is my first notmuch patch.  Comments very welcome.\r
77 >>\r
78 >> +(defun bbdb/snarf-between-commas ()\r
79 >> +  ; What about names written "Surname, First M" <user@server.tld>?\r
80 >\r
81 > I do think more sophisticated parsing is necessary. If you're lucky,\r
82 > somebody else already has a library to parse email addresses in this\r
83 > form.\r
84 \r
85 I spent the afternoon digging around in BBDB internals.  They include a\r
86 function that parses the contents of a header, and handles commas\r
87 intelligently.  It replaces essentially all the code in my small patch,\r
88 so I won't respond to your detailed comments, much as I appreciated\r
89 them.\r
90 \r
91 I have working code using bbdb-get-addresses, but I have a few questions\r
92 before I email the revised patch.\r
93 \r
94 1) Is there a canonical list of header names used by notmuch?  I'm\r
95 trying to fill in this alist to match the BBDB interface.  It should be\r
96 fine to leave blank any that notmuch doesn't handle.\r
97 \r
98 (defvar bbdb/notmuch-header-by-name\r
99   ;; both are case sensitive\r
100   '( ("From" . :From)\r
101         ("To" . :To)\r
102         ("CC" . :Cc)\r
103         ("BCC" . :Bcc)\r
104         ("Resent-From" . )\r
105         ("Reply-To" . )\r
106         ("Resent-To" . )\r
107         ("Resent-CC" . ))\r
108   "Alist for dispatching header symbols as used by notmuch-show-get-header\r
109 from strings as used by notmuch-show-get-header")\r
110 \r
111 2) What's the consensus on naming conventions?  BBDB has functions for\r
112 other mail clients with names like bbdb/gnus-* and bbdb/vm-*.  I\r
113 imitated this convention, but maybe it's better to leave the bbdb/*\r
114 namespace to BBDB itself, and use a prefix like notmuch-bbdb-* or\r
115 notmuch-bbdb/* (Regardless, I moved everything to notmuch-address.el, as\r
116 suggested)\r
117 \r
118 Thanks,\r
119 Daniel\r