[Patch v3 06/11] perf-test: add caching of xapian database
[notmuch-archives.git] / 04 / f00400e3cc5d4d8935fa968365974678893a71
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 5395F421183\r
6         for <notmuch@notmuchmail.org>; Sun,  1 Apr 2012 08:24:30 -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 WiwHSYmRGWOW for <notmuch@notmuchmail.org>;\r
16         Sun,  1 Apr 2012 08:24:29 -0700 (PDT)\r
17 Received: from idcmail-mo2no.shaw.ca (idcmail-mo2no.shaw.ca [64.59.134.9])\r
18         by olra.theworths.org (Postfix) with ESMTP id 157FD429E54\r
19         for <notmuch@notmuchmail.org>; Sun,  1 Apr 2012 08:24:29 -0700 (PDT)\r
20 Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd5ml1no-ssvc.prod.shaw.ca)\r
21         ([10.0.144.222])\r
22         by pd7mo1no-svcs.prod.shaw.ca with ESMTP; 01 Apr 2012 09:24:28 -0600\r
23 X-Cloudmark-SP-Filtered: true\r
24 X-Cloudmark-SP-Result: v=1.1 cv=bD0CuDYpMgGTku+nVSbZuKP/9fNjspX1F8zuwcoBWhM=\r
25         c=1 sm=1\r
26         a=RGYJgmOjA4MA:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17\r
27         a=A1X0JdhQAAAA:8 a=7343-z1_AAAA:8 a=EHNZZYlXirAKnDWGDg4A:9\r
28         a=lQqI-tqrjoMthOdKa7UA:7 a=Y6qChIQXU1wA:10 a=0c-eHkXYtrgA:10\r
29         a=wGuX00AKz6gQ6_xQ:21 a=5F3Wtl96xUNS4dUm:21\r
30         a=HpAAvcLHHh0Zw7uRqdWCyQ==:117\r
31 Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56])\r
32         by pd5ml1no-dmz.prod.shaw.ca with ESMTP; 01 Apr 2012 09:24:27 -0600\r
33 Received: by lagos.xvx.ca (Postfix, from userid 1000)\r
34         id D7F86800422D; Sun,  1 Apr 2012 09:24:26 -0600 (MDT)\r
35 From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
36 To: notmuch@notmuchmail.org\r
37 Subject: [BUG/PATCH v4 2/4] emacs: Fix two bugs in reply\r
38 Date: Sun,  1 Apr 2012 09:24:21 -0600\r
39 Message-Id: <1333293863-14361-3-git-send-email-awg+notmuch@xvx.ca>\r
40 X-Mailer: git-send-email 1.7.5.4\r
41 In-Reply-To: <1333293863-14361-1-git-send-email-awg+notmuch@xvx.ca>\r
42 References: <1333240404-13076-1-git-send-email-awg+notmuch@xvx.ca>\r
43         <1333293863-14361-1-git-send-email-awg+notmuch@xvx.ca>\r
44 X-BeenThere: notmuch@notmuchmail.org\r
45 X-Mailman-Version: 2.1.13\r
46 Precedence: list\r
47 List-Id: "Use and development of the notmuch mail system."\r
48         <notmuch.notmuchmail.org>\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
52 List-Post: <mailto:notmuch@notmuchmail.org>\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
56 X-List-Received-Date: Sun, 01 Apr 2012 15:24:30 -0000\r
57 \r
58 Bug 1: Replying from alternate addresses\r
59 ----------------------------------------\r
60 \r
61 The reply code was inconsistent in its use of symbols and strings for\r
62 header names being passed to message.el functions. This caused the\r
63 >From header to be lookup up incorrectly, causing an additional From\r
64 header to be added with the user's primary address instead of the\r
65 correct alternate address.\r
66 \r
67 This is fixed by using symbols everywhere, i.e. never using strings\r
68 for header names when interacting with message.el.\r
69 \r
70 This change also removes our use of `mail-header`, since we don't use\r
71 it anywhere else, and using assq makes it clear how the header lists\r
72 are expected to work.\r
73 \r
74 Bug 2: Duplicate headers in emacs 23.2\r
75 --------------------------------------\r
76 \r
77 The message.el code in emacs 23.2 assumes that header names will\r
78 always be passed as symbols, so our use of strings caused\r
79 problems. The symptom was that on 23.2 (and presumably on earlier\r
80 versions) the reply message would end up with two of some headers.\r
81 \r
82 Converting everything to symbols also fixes this issue.\r
83 ---\r
84  emacs/notmuch-lib.el |    7 +++++--\r
85  emacs/notmuch-mua.el |   10 +++++-----\r
86  test/emacs           |    1 -\r
87  3 files changed, 10 insertions(+), 8 deletions(-)\r
88 \r
89 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
90 index c159dda..6907a5f 100644\r
91 --- a/emacs/notmuch-lib.el\r
92 +++ b/emacs/notmuch-lib.el\r
93 @@ -237,9 +237,12 @@ the given type."\r
94    (or (plist-get part :content)\r
95        (notmuch-get-bodypart-internal (notmuch-id-to-query (plist-get msg :id)) nth process-crypto)))\r
96  \r
97 -(defun notmuch-plist-to-alist (plist)\r
98 +;; Converts a plist of headers to an alist of headers. The input plist should\r
99 +;; have symbols of the form :Header as keys, and the resulting alist will have\r
100 +;; symbols of the form 'Header as keys.\r
101 +(defun notmuch-headers-plist-to-alist (plist)\r
102    (loop for (key value . rest) on plist by #'cddr\r
103 -       collect (cons (substring (symbol-name key) 1) value)))\r
104 +       collect (cons (intern (substring (symbol-name key) 1)) value)))\r
105  \r
106  ;; Compatibility functions for versions of emacs before emacs 23.\r
107  ;;\r
108 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
109 index 6aae3a0..cfa3d61 100644\r
110 --- a/emacs/notmuch-mua.el\r
111 +++ b/emacs/notmuch-mua.el\r
112 @@ -127,7 +127,7 @@ list."\r
113           ((same-window-regexps '("\\*mail .*")))\r
114         (notmuch-mua-mail (plist-get reply-headers :To)\r
115                           (plist-get reply-headers :Subject)\r
116 -                         (notmuch-plist-to-alist reply-headers)))\r
117 +                         (notmuch-headers-plist-to-alist reply-headers)))\r
118        ;; Insert the message body - but put it in front of the signature\r
119        ;; if one is present\r
120        (goto-char (point-max))\r
121 @@ -185,11 +185,11 @@ OTHER-ARGS are passed through to `message-mail'."\r
122    (when notmuch-mua-user-agent-function\r
123      (let ((user-agent (funcall notmuch-mua-user-agent-function)))\r
124        (when (not (string= "" user-agent))\r
125 -       (push (cons "User-Agent" user-agent) other-headers))))\r
126 +       (push (cons 'User-Agent user-agent) other-headers))))\r
127  \r
128 -  (unless (mail-header 'From other-headers)\r
129 -    (push (cons "From" (concat\r
130 -                       (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))\r
131 +  (unless (assq 'From other-headers)\r
132 +    (push (cons 'From (concat\r
133 +                      (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))\r
134  \r
135    (apply #'message-mail to subject other-headers other-args)\r
136    (message-sort-headers)\r
137 diff --git a/test/emacs b/test/emacs\r
138 index 576bc1f..30654bb 100755\r
139 --- a/test/emacs\r
140 +++ b/test/emacs\r
141 @@ -286,7 +286,6 @@ EOF\r
142  test_expect_equal_file OUTPUT EXPECTED\r
143  \r
144  test_begin_subtest "Reply from alternate address within emacs"\r
145 -test_subtest_known_broken\r
146  add_message '[from]="Sender <sender@example.com>"' \\r
147              [to]=test_suite_other@notmuchmail.org\r
148  \r
149 -- \r
150 1.7.5.4\r
151 \r