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 F10EA431FAF
\r
6 for <notmuch@notmuchmail.org>; Wed, 28 Mar 2012 21:53:41 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 aYPiasV9jZ6O for <notmuch@notmuchmail.org>;
\r
16 Wed, 28 Mar 2012 21:53:41 -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 76BE6431FAE
\r
19 for <notmuch@notmuchmail.org>; Wed, 28 Mar 2012 21:53:41 -0700 (PDT)
\r
20 Received: from lb7f8hsrpno-svcs.dcs.int.inet (HELO pd7ml1no-ssvc.prod.shaw.ca)
\r
22 by pd7mo1no-svcs.prod.shaw.ca with ESMTP; 28 Mar 2012 22:53:41 -0600
\r
23 X-Cloudmark-SP-Filtered: true
\r
24 X-Cloudmark-SP-Result: v=1.1 cv=Ro8QOmc0aMDfanRtxUddlQ8SbE2D0zCZP8MBHZpYE5w=
\r
26 a=82UIbAjXKL0A:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17
\r
27 a=4U69qDNLMXPqwlrapeIA:9 a=R8Bxcb_Lm8ZuesaYTjMA:7
\r
28 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
\r
29 Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56])
\r
30 by pd7ml1no-dmz.prod.shaw.ca with ESMTP; 28 Mar 2012 22:53:40 -0600
\r
31 Received: by lagos.xvx.ca (Postfix, from userid 1000)
\r
32 id 4D0AD8004204; Wed, 28 Mar 2012 22:53:40 -0600 (MDT)
\r
33 From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [BUG/PATCH v2] emacs: Fix the References header in reply
\r
36 Date: Wed, 28 Mar 2012 22:53:38 -0600
\r
37 Message-Id: <1332996818-15700-1-git-send-email-awg+notmuch@xvx.ca>
\r
38 X-Mailer: git-send-email 1.7.5.4
\r
39 In-Reply-To: <1332991226-510-1-git-send-email-awg+notmuch@xvx.ca>
\r
40 References: <1332991226-510-1-git-send-email-awg+notmuch@xvx.ca>
\r
41 X-BeenThere: notmuch@notmuchmail.org
\r
42 X-Mailman-Version: 2.1.13
\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: Thu, 29 Mar 2012 04:53:42 -0000
\r
55 In the new reply code, the References header gets inserted by
\r
56 message.el using a function called message-shorten-references. Unlike
\r
57 all the other header-inserting functions, it doesn't put a newline
\r
58 after the header, causing the next header to end up on the same
\r
59 line. In our case, this header happened to be User-Agent, so it's hard
\r
60 to notice. This is probably a bug in message.el, but we need to work
\r
63 This fixes the problem by wrapping message-shorten-references in a
\r
64 function that inserts a newline after if necessary. This should
\r
65 protect against the message.el bug being fixed in the future.
\r
68 This version adds the local variables to suppress 'cl warings, per
\r
69 id:"1332995623-9055-1-git-send-email-amdragon@mit.edu".
\r
71 emacs/notmuch-mua.el | 26 +++++++++++++++++++++++---
\r
72 1 files changed, 23 insertions(+), 3 deletions(-)
\r
74 diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
\r
75 index 24918d3..0d3fcd3 100644
\r
76 --- a/emacs/notmuch-mua.el
\r
77 +++ b/emacs/notmuch-mua.el
\r
78 @@ -90,6 +90,15 @@ list."
\r
79 else if (notmuch-match-content-type (plist-get part :content-type) "text/*")
\r
82 +;; There is a bug in emacs 23's message.el that results in a newline
\r
83 +;; not being inserted after the References header, so the next header
\r
84 +;; is concatenated to the end of it. This function fixes the problem,
\r
85 +;; while guarding against the possibility that some current or future
\r
86 +;; version of emacs has the bug fixed.
\r
87 +(defun notmuch-mua-insert-references (header references)
\r
88 + (message-shorten-references header references)
\r
89 + (unless (bolp) (insert "\n")))
\r
91 (defun notmuch-mua-reply (query-string &optional sender reply-all)
\r
92 (let ((args '("reply" "--format=json"))
\r
94 @@ -125,9 +134,16 @@ list."
\r
95 ;; Overlay the composition window on that being used to read
\r
96 ;; the original message.
\r
97 ((same-window-regexps '("\\*mail .*")))
\r
98 - (notmuch-mua-mail (plist-get reply-headers :To)
\r
99 - (plist-get reply-headers :Subject)
\r
100 - (notmuch-plist-to-alist reply-headers)))
\r
102 + ;; We modify message-header-format-alist to get around a bug in message.el.
\r
103 + ;; See the comment above on notmuch-mua-insert-references.
\r
104 + (let ((message-header-format-alist
\r
105 + (append '((References . notmuch-mua-insert-references))
\r
106 + (remove-if (lambda (x) (eq (car x) 'References))
\r
107 + message-header-format-alist))))
\r
108 + (notmuch-mua-mail (plist-get reply-headers :To)
\r
109 + (plist-get reply-headers :Subject)
\r
110 + (notmuch-plist-to-alist reply-headers))))
\r
111 ;; Insert the message body - but put it in front of the signature
\r
112 ;; if one is present
\r
113 (goto-char (point-max))
\r
114 @@ -301,3 +317,7 @@ simply runs the corresponding `message-mode' hook functions."
\r
117 (provide 'notmuch-mua)
\r
119 +;; Local Variables:
\r
120 +;; byte-compile-warnings: (not cl-functions)
\r