Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / e3 / 7959355fcaf885da64047a57877e287825d0cc
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 ED936431FAF\r
6         for <notmuch@notmuchmail.org>; Wed, 28 Mar 2012 07:02:29 -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 nvt+UWz77nhS for <notmuch@notmuchmail.org>;\r
16         Wed, 28 Mar 2012 07:02:29 -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 77197431FAE\r
19         for <notmuch@notmuchmail.org>; Wed, 28 Mar 2012 07:02:29 -0700 (PDT)\r
20 Received: from pd3ml2so-ssvc.prod.shaw.ca ([10.0.141.138])\r
21         by pd3mo1so-svcs.prod.shaw.ca with ESMTP; 28 Mar 2012 08:02:29 -0600\r
22 X-Cloudmark-SP-Filtered: true\r
23 X-Cloudmark-SP-Result: v=1.1 cv=w8ylZ/s5/CpB4NtJ57cq/Y3wf+h+jIFeVVN4WVEh/uc=\r
24         c=1 sm=1\r
25         a=S0R2Cj-5jVsA:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17\r
26         a=Oc9B4HQ8RdShrQTKbjUA:9 a=LlVLWLaIUwi6vdQPZ44A:7 a=Eo7dM2StyDUXn3Oo:21\r
27         a=AdxvkLXnfx2Hsqoe:21 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117\r
28 Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56])\r
29         by pd3ml2so-dmz.prod.shaw.ca with ESMTP; 28 Mar 2012 08:02:28 -0600\r
30 Received: by lagos.xvx.ca (Postfix, from userid 1000)\r
31         id 6E6C28004204; Wed, 28 Mar 2012 08:02:28 -0600 (MDT)\r
32 From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
33 To: notmuch@notmuchmail.org,\r
34         jani@nikula.org\r
35 Subject: [BUG/PATCH] emacs: Fix header problem in reply for emacs 23.2\r
36 Date: Wed, 28 Mar 2012 08:02:18 -0600\r
37 Message-Id: <1332943338-9708-1-git-send-email-awg+notmuch@xvx.ca>\r
38 X-Mailer: git-send-email 1.7.5.4\r
39 In-Reply-To: <87obrh3ufi.fsf@nikula.org>\r
40 References: <87obrh3ufi.fsf@nikula.org>\r
41 X-BeenThere: notmuch@notmuchmail.org\r
42 X-Mailman-Version: 2.1.13\r
43 Precedence: list\r
44 List-Id: "Use and development of the notmuch mail system."\r
45         <notmuch.notmuchmail.org>\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
49 List-Post: <mailto:notmuch@notmuchmail.org>\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
53 X-List-Received-Date: Wed, 28 Mar 2012 14:02:30 -0000\r
54 \r
55 The new reply code used strings instead of symbols for header names,\r
56 which message-mail is OK with on emacs 23.3, but not 23.2. The symptom\r
57 is that on 23.2 (and presumably on earlier versions) the reply message\r
58 would end up with two of some headers.\r
59 \r
60 This fixes the problem by converting the header names to symbols of\r
61 the type message.el usually expects before passing the headers to\r
62 message-mail.\r
63 ---\r
64  emacs/notmuch-lib.el |    5 ++++-\r
65  emacs/notmuch-mua.el |   10 +++++-----\r
66  2 files changed, 9 insertions(+), 6 deletions(-)\r
67 \r
68 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
69 index c146748..af46611 100644\r
70 --- a/emacs/notmuch-lib.el\r
71 +++ b/emacs/notmuch-lib.el\r
72 @@ -232,9 +232,12 @@ the given type."\r
73    (or (plist-get part :content)\r
74        (notmuch-get-bodypart-internal (concat "id:" (plist-get msg :id)) nth process-crypto)))\r
75  \r
76 +;; Converts a plist of headers to an alist of headers. The input plist should\r
77 +;; have symbols of the form :Header as keys, and the resulting alist will have\r
78 +;; symbols of the form 'Header as keys.\r
79  (defun notmuch-plist-to-alist (plist)\r
80    (loop for (key value . rest) on plist by #'cddr\r
81 -       collect (cons (substring (symbol-name key) 1) value)))\r
82 +       collect (cons (intern (substring (symbol-name key) 1)) value)))\r
83  \r
84  ;; Compatibility functions for versions of emacs before emacs 23.\r
85  ;;\r
86 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
87 index 9805d79..24918d3 100644\r
88 --- a/emacs/notmuch-mua.el\r
89 +++ b/emacs/notmuch-mua.el\r
90 @@ -185,11 +185,11 @@ OTHER-ARGS are passed through to `message-mail'."\r
91    (when notmuch-mua-user-agent-function\r
92      (let ((user-agent (funcall notmuch-mua-user-agent-function)))\r
93        (when (not (string= "" user-agent))\r
94 -       (push (cons "User-Agent" user-agent) other-headers))))\r
95 +       (push (cons 'User-Agent user-agent) other-headers))))\r
96  \r
97 -  (unless (assoc "From" other-headers)\r
98 -    (push (cons "From" (concat\r
99 -                       (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))\r
100 +  (unless (assq 'From other-headers)\r
101 +    (push (cons 'From (concat\r
102 +                      (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))\r
103  \r
104    (apply #'message-mail to subject other-headers other-args)\r
105    (message-sort-headers)\r
106 @@ -250,7 +250,7 @@ the From: address first."\r
107    (interactive "P")\r
108    (let ((other-headers\r
109          (when (or prompt-for-sender notmuch-always-prompt-for-sender)\r
110 -          (list (cons "From" (notmuch-mua-prompt-for-sender))))))\r
111 +          (list (cons 'From (notmuch-mua-prompt-for-sender))))))\r
112      (notmuch-mua-mail nil nil other-headers)))\r
113  \r
114  (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)\r
115 -- \r
116 1.7.5.4\r
117 \r