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