[BUG/PATCH v2 1/2] emacs: Fix header problem in reply for emacs 23.2
authorAdam Wolfe Gordon <awg+notmuch@xvx.ca>
Thu, 29 Mar 2012 16:26:49 +0000 (10:26 +1800)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:45:51 +0000 (09:45 -0800)
0b/85cf16fda0c3ec05a0ee1b05063785d5e187b7 [new file with mode: 0644]

diff --git a/0b/85cf16fda0c3ec05a0ee1b05063785d5e187b7 b/0b/85cf16fda0c3ec05a0ee1b05063785d5e187b7
new file mode 100644 (file)
index 0000000..9ca9a47
--- /dev/null
@@ -0,0 +1,126 @@
+Return-Path: <awg@lagos.xvx.ca>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 3634E431FB6\r
+       for <notmuch@notmuchmail.org>; Thu, 29 Mar 2012 09:26:56 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id otOHEg5lhagP for <notmuch@notmuchmail.org>;\r
+       Thu, 29 Mar 2012 09:26:55 -0700 (PDT)\r
+Received: from idcmail-mo1so.shaw.ca (idcmail-mo1so.shaw.ca [24.71.223.10])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8D827431FAE\r
+       for <notmuch@notmuchmail.org>; Thu, 29 Mar 2012 09:26:55 -0700 (PDT)\r
+Received: from pd3ml3so-ssvc.prod.shaw.ca ([10.0.141.149])\r
+       by pd3mo1so-svcs.prod.shaw.ca with ESMTP; 29 Mar 2012 10:26:55 -0600\r
+X-Cloudmark-SP-Filtered: true\r
+X-Cloudmark-SP-Result: v=1.1 cv=zk9oM8twhc3i0pWciPL6Xc/pqaeDF/K3qFEQp81fRTo=\r
+       c=1 sm=1\r
+       a=A2IzPUtbtskA:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17\r
+       a=ytvjk7XqzZDQVcTpp0kA:9 a=s66WX973fBH2KQ0_X2AA:7 a=Rd0djehA27l3KTlY:21\r
+       a=5PToDfdYytSk4Sii:21 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117\r
+Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56])\r
+       by pd3ml3so-dmz.prod.shaw.ca with ESMTP; 29 Mar 2012 10:26:55 -0600\r
+Received: by lagos.xvx.ca (Postfix, from userid 1000)\r
+       id 188A88004204; Thu, 29 Mar 2012 10:26:55 -0600 (MDT)\r
+From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
+To: notmuch@notmuchmail.org\r
+Subject: [BUG/PATCH v2 1/2] emacs: Fix header problem in reply for emacs 23.2\r
+Date: Thu, 29 Mar 2012 10:26:49 -0600\r
+Message-Id: <1333038410-17927-2-git-send-email-awg+notmuch@xvx.ca>\r
+X-Mailer: git-send-email 1.7.5.4\r
+In-Reply-To: <1333038410-17927-1-git-send-email-awg+notmuch@xvx.ca>\r
+References: <1333038410-17927-1-git-send-email-awg+notmuch@xvx.ca>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 29 Mar 2012 16:26:56 -0000\r
+\r
+The new reply code used strings instead of symbols for header names,\r
+which message-mail is OK with on emacs 23.3, but not 23.2. The symptom\r
+is that on 23.2 (and presumably on earlier versions) the reply message\r
+would end up with two of some headers.\r
+\r
+This fixes the problem by converting the header names to symbols of\r
+the type message.el usually expects before passing the headers to\r
+message-mail.\r
+---\r
+ emacs/notmuch-lib.el |    7 +++++--\r
+ emacs/notmuch-mua.el |   12 ++++++------\r
+ 2 files changed, 11 insertions(+), 8 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
+index c146748..0effe24 100644\r
+--- a/emacs/notmuch-lib.el\r
++++ b/emacs/notmuch-lib.el\r
+@@ -232,9 +232,12 @@ the given type."\r
+   (or (plist-get part :content)\r
+       (notmuch-get-bodypart-internal (concat "id:" (plist-get msg :id)) nth process-crypto)))\r
\r
+-(defun notmuch-plist-to-alist (plist)\r
++;; Converts a plist of headers to an alist of headers. The input plist should\r
++;; have symbols of the form :Header as keys, and the resulting alist will have\r
++;; symbols of the form 'Header as keys.\r
++(defun notmuch-headers-plist-to-alist (plist)\r
+   (loop for (key value . rest) on plist by #'cddr\r
+-      collect (cons (substring (symbol-name key) 1) value)))\r
++      collect (cons (intern (substring (symbol-name key) 1)) value)))\r
\r
+ ;; Compatibility functions for versions of emacs before emacs 23.\r
+ ;;\r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index 9805d79..cfa3d61 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -127,7 +127,7 @@ list."\r
+         ((same-window-regexps '("\\*mail .*")))\r
+       (notmuch-mua-mail (plist-get reply-headers :To)\r
+                         (plist-get reply-headers :Subject)\r
+-                        (notmuch-plist-to-alist reply-headers)))\r
++                        (notmuch-headers-plist-to-alist reply-headers)))\r
+       ;; Insert the message body - but put it in front of the signature\r
+       ;; if one is present\r
+       (goto-char (point-max))\r
+@@ -185,11 +185,11 @@ OTHER-ARGS are passed through to `message-mail'."\r
+   (when notmuch-mua-user-agent-function\r
+     (let ((user-agent (funcall notmuch-mua-user-agent-function)))\r
+       (when (not (string= "" user-agent))\r
+-      (push (cons "User-Agent" user-agent) other-headers))))\r
++      (push (cons 'User-Agent user-agent) other-headers))))\r
\r
+-  (unless (assoc "From" other-headers)\r
+-    (push (cons "From" (concat\r
+-                      (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))\r
++  (unless (assq 'From other-headers)\r
++    (push (cons 'From (concat\r
++                     (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-headers))\r
\r
+   (apply #'message-mail to subject other-headers other-args)\r
+   (message-sort-headers)\r
+@@ -250,7 +250,7 @@ the From: address first."\r
+   (interactive "P")\r
+   (let ((other-headers\r
+        (when (or prompt-for-sender notmuch-always-prompt-for-sender)\r
+-         (list (cons "From" (notmuch-mua-prompt-for-sender))))))\r
++         (list (cons 'From (notmuch-mua-prompt-for-sender))))))\r
+     (notmuch-mua-mail nil nil other-headers)))\r
\r
+ (defun notmuch-mua-new-forward-message (&optional prompt-for-sender)\r
+-- \r
+1.7.5.4\r
+\r