[Patch v4 1/9] test: Add two tests for error output from notmuch_database_open
[notmuch-archives.git] / a9 / 97cbd5739f8e177082d9ebe92c676a91cbbade
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 23947431FB6\r
6         for <notmuch@notmuchmail.org>; Sat, 24 Mar 2012 17:27:21 -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 f6jFaa8SCuM1 for <notmuch@notmuchmail.org>;\r
16         Sat, 24 Mar 2012 17:27:20 -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 91091431FAF\r
19         for <notmuch@notmuchmail.org>; Sat, 24 Mar 2012 17:27:20 -0700 (PDT)\r
20 Received: from pd2ml3so-ssvc.prod.shaw.ca ([10.0.141.148])\r
21         by pd3mo1so-svcs.prod.shaw.ca with ESMTP; 24 Mar 2012 18:27:19 -0600\r
22 X-Cloudmark-SP-Filtered: true\r
23 X-Cloudmark-SP-Result: v=1.1 cv=W+ZrOcpwHTeQLvZQ9vbIxXRdvbK5p6H2/T6SuQCN924=\r
24         c=1 sm=1\r
25         a=h0XYkkGVRQAA: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=6DQpROzzP55a9Xli:21 a=buo2DCiuL2TCTNuT:21\r
29         a=HpAAvcLHHh0Zw7uRqdWCyQ==:117\r
30 Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56])\r
31         by pd2ml3so-dmz.prod.shaw.ca with ESMTP; 24 Mar 2012 18:27:19 -0600\r
32 Received: by lagos.xvx.ca (Postfix, from userid 1000)\r
33         id 1EAE0800482B; Sat, 24 Mar 2012 18:27:19 -0600 (MDT)\r
34 From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
35 To: notmuch@notmuchmail.org\r
36 Subject: [BUG/PATCH 2/2] emacs: Fix replying from alternate addresses\r
37 Date: Sat, 24 Mar 2012 18:27:12 -0600\r
38 Message-Id: <1332635232-15269-3-git-send-email-awg+notmuch@xvx.ca>\r
39 X-Mailer: git-send-email 1.7.5.4\r
40 In-Reply-To: <1332635232-15269-1-git-send-email-awg+notmuch@xvx.ca>\r
41 References: <1332635232-15269-1-git-send-email-awg+notmuch@xvx.ca>\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.13\r
44 Precedence: list\r
45 List-Id: "Use and development of the notmuch mail system."\r
46         <notmuch.notmuchmail.org>\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
48         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
50 List-Post: <mailto:notmuch@notmuchmail.org>\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
54 X-List-Received-Date: Sun, 25 Mar 2012 00:27:21 -0000\r
55 \r
56 The bug was that notmuch-mua-mail used `mail-header` to check whether\r
57 it was passed a "From" header. The implementation of `mail-header`\r
58 must try to compare symbols instead of strings when looking for\r
59 headers, as it was returning nil when a From header was present. This\r
60 is probably because the mail functions construct headers as alists\r
61 with symbols for the header names, while our code uses strings for the\r
62 header names.\r
63 \r
64 Since we don't use `mail-header` anywhere else, and `message-mail` is\r
65 perfectly happy to accept string header names, the fix is just to use\r
66 `assoc` to look for the From header, so that the strings get compared\r
67 properly.\r
68 ---\r
69  emacs/notmuch-mua.el |    4 ++--\r
70  test/emacs           |    1 -\r
71  2 files changed, 2 insertions(+), 3 deletions(-)\r
72 \r
73 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
74 index 6aae3a0..9805d79 100644\r
75 --- a/emacs/notmuch-mua.el\r
76 +++ b/emacs/notmuch-mua.el\r
77 @@ -187,7 +187,7 @@ OTHER-ARGS are passed through to `message-mail'."\r
78        (when (not (string= "" user-agent))\r
79         (push (cons "User-Agent" user-agent) other-headers))))\r
80  \r
81 -  (unless (mail-header 'From other-headers)\r
82 +  (unless (assoc "From" other-headers)\r
83      (push (cons "From" (concat\r
84                         (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))\r
85  \r
86 @@ -250,7 +250,7 @@ the From: address first."\r
87    (interactive "P")\r
88    (let ((other-headers\r
89          (when (or prompt-for-sender notmuch-always-prompt-for-sender)\r
90 -          (list (cons 'From (notmuch-mua-prompt-for-sender))))))\r
91 +          (list (cons "From" (notmuch-mua-prompt-for-sender))))))\r
92      (notmuch-mua-mail nil nil other-headers)))\r
93  \r
94  (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)\r
95 diff --git a/test/emacs b/test/emacs\r
96 index fa5d706..08db1ee 100755\r
97 --- a/test/emacs\r
98 +++ b/test/emacs\r
99 @@ -275,7 +275,6 @@ EOF\r
100  test_expect_equal_file OUTPUT EXPECTED\r
101  \r
102  test_begin_subtest "Reply from alternate address within emacs"\r
103 -test_subtest_known_broken\r
104  add_message '[from]="Sender <sender@example.com>"' \\r
105              [to]=test_suite_other@notmuchmail.org \\r
106              [subject]=notmuch-reply-test \\r
107 -- \r
108 1.7.5.4\r
109 \r