[PATCH] lib: provide _notmuch_database_log_append
[notmuch-archives.git] / 6e / b90dd132e34137d23a77363a90dd639c523a6c
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 4B549431FAF\r
6         for <notmuch@notmuchmail.org>; Thu, 26 Jul 2012 13:09:20 -0700 (PDT)\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 pRUhVsNA2P8e for <notmuch@notmuchmail.org>;\r
17         Thu, 26 Jul 2012 13:09:19 -0700 (PDT)\r
18 Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com\r
19         [66.111.4.27])\r
20         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id A2B83431FAE\r
23         for <notmuch@notmuchmail.org>; Thu, 26 Jul 2012 13:09:19 -0700 (PDT)\r
24 Received: from compute6.internal (compute6.nyi.mail.srv.osa [10.202.2.46])\r
25         by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id C9F152095D\r
26         for <notmuch@notmuchmail.org>; Thu, 26 Jul 2012 16:09:18 -0400 (EDT)\r
27 Received: from frontend1.nyi.mail.srv.osa ([10.202.2.160])\r
28         by compute6.internal (MEProxy); Thu, 26 Jul 2012 16:09:18 -0400\r
29 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=\r
30         messagingengine.com; h=from:to:subject:date:message-id\r
31         :mime-version:content-type; s=smtpout; bh=3nqgk+45uXngWez2eLZIny\r
32         DNj3s=; b=Xa9kb+ggRgEVrk1tUWCfW9HQYqar8j+IlchDbN3XMTSpBGtqFCvAAm\r
33         mOvq7i/YZg5GvGreGfi/Lpwc6RnN0HbQ17JZJAgZNS/7Yb/UxestcfaZVVmi4xeR\r
34         VwX2Qm5ahyogdYZNnko6FNvcse/cy4dixbYZcUZClt9cU2Ak1ugxU=\r
35 X-Sasl-enc: FJlfgQsaBc+25vmAKS5SUJhl4RxULsKA6LGy3h7IQn0z 1343333358\r
36 Received: from localhost (unknown [66.80.90.109])\r
37         by mail.messagingengine.com (Postfix) with ESMTPA id 89BCE8E03C0\r
38         for <notmuch@notmuchmail.org>; Thu, 26 Jul 2012 16:09:18 -0400 (EDT)\r
39 From: Daniel Bergey <bergey@alum.mit.edu>\r
40 To: Notmuch Mail List <notmuch@notmuchmail.org>\r
41 Subject: [PATCH] emacs: functions to import sender or recipient into BBDB\r
42 User-Agent: Notmuch/0.13.2 (http://notmuchmail.org) Emacs/23.4.1\r
43         (i486-pc-linux-gnu)\r
44 Date: Thu, 26 Jul 2012 16:09:17 -0400\r
45 Message-ID: <87lii62sk2.fsf@wonderlust.lan>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain; charset=us-ascii\r
48 X-BeenThere: notmuch@notmuchmail.org\r
49 X-Mailman-Version: 2.1.13\r
50 Precedence: list\r
51 List-Id: "Use and development of the notmuch mail system."\r
52         <notmuch.notmuchmail.org>\r
53 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
55 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
56 List-Post: <mailto:notmuch@notmuchmail.org>\r
57 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
58 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
59         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
60 X-List-Received-Date: Thu, 26 Jul 2012 20:09:20 -0000\r
61 \r
62 >From a show buffer, bbdb/notmuch-snarf-from imports the sender into\r
63 bbdb.  bbdb/notmuch-snarf-to attempts to import all recipients.  BBDB\r
64 displays a buffer with each contact; C-g displays the next contact, or\r
65 returns to the notmuch-show buffer.\r
66 \r
67 Both functions assume that email contacts are seperated by commas.  If a\r
68 comma is included in a name, it will try to make two separate\r
69 contacts.\r
70 ---\r
71 This is my first notmuch patch.  Comments very welcome.\r
72 \r
73  emacs/notmuch-show.el |   28 ++++++++++++++++++++++++++++\r
74  1 file changed, 28 insertions(+)\r
75 \r
76 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
77 index 6335d45..3bc1da0 100644\r
78 --- a/emacs/notmuch-show.el\r
79 +++ b/emacs/notmuch-show.el\r
80 @@ -1895,6 +1895,34 @@ the user (see `notmuch-show-stash-mlarchive-link-alist')."\r
81                        (button-get button :notmuch-filename)\r
82                        (button-get button :notmuch-content-type)))))))\r
83  \r
84 +;; bbdb interaction functions, awaiting user keybindings\r
85 +\r
86 +(defun bbdb/snarf-between-commas ()\r
87 +  ; What about names written "Surname, First M" <user@server.tld>?\r
88 +  (goto-char (point-min))\r
89 +  (let ((comma (point)))\r
90 +    (while (search-forward "," nil "end")\r
91 +      (bbdb-snarf-region comma (point))\r
92 +      (setq comma (point)))\r
93 +    (bbdb-snarf-region comma (point)) ; last entry\r
94 +   ))\r
95 +\r
96 +(defun bbdb/notmuch-snarf-header (header)\r
97 +  (let ((text (notmuch-show-get-header header)))\r
98 +    (with-temp-buffer\r
99 +      (insert text)\r
100 +      (bbdb/snarf-between-commas))))\r
101 +\r
102 +(defun bbdb/notmuch-snarf-from ()\r
103 +  "Import the sender of the current message into BBDB"\r
104 +  (interactive)\r
105 +  (bbdb/notmuch-snarf-header :From))\r
106 +\r
107 +(defun bbdb/notmuch-snarf-to ()\r
108 +  "Import all recipients of the current message into BBDB"\r
109 +  (interactive)\r
110 +  (bbdb/notmuch-snarf-header :To))\r
111 +\r
112  ;;\r
113  \r
114  (provide 'notmuch-show)\r
115 -- \r
116 1.7.10.4\r
117 \r