[PATCH] lib: provide _notmuch_database_log_append
[notmuch-archives.git] / 3f / 6938bf43bc41afecf311d4fa4895bca2b0a91f
1 Return-Path: <awg@lagos.xvx.ca>\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 DA167431FBF\r
6         for <notmuch@notmuchmail.org>; Wed, 28 Mar 2012 06:33:59 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id RORpNxCYrT3G for <notmuch@notmuchmail.org>;\r
16         Wed, 28 Mar 2012 06:33:59 -0700 (PDT)\r
17 Received: from idcmail-mo1so.shaw.ca (idcmail-mo1so.shaw.ca [24.71.223.10])\r
18         by olra.theworths.org (Postfix) with ESMTP id 08AA5431FAE\r
19         for <notmuch@notmuchmail.org>; Wed, 28 Mar 2012 06:33:58 -0700 (PDT)\r
20 Received: from pd2ml2so-ssvc.prod.shaw.ca ([10.0.141.134])\r
21         by pd2mo1so-svcs.prod.shaw.ca with ESMTP; 28 Mar 2012 07:33:58 -0600\r
22 X-Cloudmark-SP-Filtered: true\r
23 X-Cloudmark-SP-Result: v=1.1 cv=FBhiVrZmCxhz+jlnxOWeJaR14+PwdUeacMZGNnSzbtQ=\r
24         c=1 sm=1\r
25         a=orNGVW25YFkA:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17\r
26         a=A1X0JdhQAAAA:8 a=7343-z1_AAAA:8 a=kruYVQ-tQJgX6LSJxeAA:9\r
27         a=ErgTTcISGBnhqq40-fwA:7 a=Y6qChIQXU1wA:10 a=0c-eHkXYtrgA:10\r
28         a=WJfXdXBIiwVsjGxf:21 a=TlY5ANsmuuyg24_V:21\r
29         a=HpAAvcLHHh0Zw7uRqdWCyQ==:117\r
30 Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56])\r
31         by pd2ml2so-dmz.prod.shaw.ca with ESMTP; 28 Mar 2012 07:33:58 -0600\r
32 Received: by lagos.xvx.ca (Postfix, from userid 1000)\r
33         id DE38B800422C; Wed, 28 Mar 2012 07:33:57 -0600 (MDT)\r
34 From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [BUG/PATCH v2 2/2] emacs: Fix replying from alternate addresses\r
37 Date: Wed, 28 Mar 2012 07:33:55 -0600\r
38 Message-Id: <1332941635-21019-3-git-send-email-awg+notmuch@xvx.ca>\r
39 X-Mailer: git-send-email 1.7.5.4\r
40 In-Reply-To: <1332941635-21019-1-git-send-email-awg+notmuch@xvx.ca>\r
41 References: <1332635232-15269-1-git-send-email-awg+notmuch@xvx.ca>\r
42         <1332941635-21019-1-git-send-email-awg+notmuch@xvx.ca>\r
43 X-BeenThere: notmuch@notmuchmail.org\r
44 X-Mailman-Version: 2.1.13\r
45 Precedence: list\r
46 List-Id: "Use and development of the notmuch mail system."\r
47         <notmuch.notmuchmail.org>\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
51 List-Post: <mailto:notmuch@notmuchmail.org>\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
54         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
55 X-List-Received-Date: Wed, 28 Mar 2012 13:34:00 -0000\r
56 \r
57 The bug was that notmuch-mua-mail used `mail-header` to check whether\r
58 it was passed a "From" header. The implementation of `mail-header`\r
59 must try to compare symbols instead of strings when looking for\r
60 headers, as it was returning nil when a From header was present. This\r
61 is probably because the mail functions construct headers as alists\r
62 with symbols for the header names, while our code uses strings for the\r
63 header names.\r
64 \r
65 Since we don't use `mail-header` anywhere else, and `message-mail` is\r
66 perfectly happy to accept string header names, the fix is just to use\r
67 `assoc` to look for the From header, so that the strings get compared\r
68 properly.\r
69 ---\r
70  emacs/notmuch-mua.el |    4 ++--\r
71  test/emacs           |    1 -\r
72  2 files changed, 2 insertions(+), 3 deletions(-)\r
73 \r
74 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
75 index 6aae3a0..9805d79 100644\r
76 --- a/emacs/notmuch-mua.el\r
77 +++ b/emacs/notmuch-mua.el\r
78 @@ -187,7 +187,7 @@ OTHER-ARGS are passed through to `message-mail'."\r
79        (when (not (string= "" user-agent))\r
80         (push (cons "User-Agent" user-agent) other-headers))))\r
81  \r
82 -  (unless (mail-header 'From other-headers)\r
83 +  (unless (assoc "From" other-headers)\r
84      (push (cons "From" (concat\r
85                         (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))\r
86  \r
87 @@ -250,7 +250,7 @@ the From: address first."\r
88    (interactive "P")\r
89    (let ((other-headers\r
90          (when (or prompt-for-sender notmuch-always-prompt-for-sender)\r
91 -          (list (cons 'From (notmuch-mua-prompt-for-sender))))))\r
92 +          (list (cons "From" (notmuch-mua-prompt-for-sender))))))\r
93      (notmuch-mua-mail nil nil other-headers)))\r
94  \r
95  (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)\r
96 diff --git a/test/emacs b/test/emacs\r
97 index 3402efb..06291d3 100755\r
98 --- a/test/emacs\r
99 +++ b/test/emacs\r
100 @@ -275,7 +275,6 @@ EOF\r
101  test_expect_equal_file OUTPUT EXPECTED\r
102  \r
103  test_begin_subtest "Reply from alternate address within emacs"\r
104 -test_subtest_known_broken\r
105  add_message '[from]="Sender <sender@example.com>"' \\r
106              [to]=test_suite_other@notmuchmail.org\r
107  \r
108 -- \r
109 1.7.5.4\r
110 \r