From: Mark Walters Date: Sat, 31 Mar 2012 09:13:53 +0000 (+0100) Subject: Re: [BUG/PATCH v2 1/2] emacs: Fix header problem in reply for emacs 23.2 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=57f09e1e05db9918ddad7767acc8c01dc6d2d35b;p=notmuch-archives.git Re: [BUG/PATCH v2 1/2] emacs: Fix header problem in reply for emacs 23.2 --- diff --git a/e5/e2142501b352b6dcaadbe3240a2fbe912ed60d b/e5/e2142501b352b6dcaadbe3240a2fbe912ed60d new file mode 100644 index 000000000..4e3819a4e --- /dev/null +++ b/e5/e2142501b352b6dcaadbe3240a2fbe912ed60d @@ -0,0 +1,176 @@ +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 BAC00431FAF + for ; Sat, 31 Mar 2012 02:13:46 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 fO4cbGedxEYX for ; + Sat, 31 Mar 2012 02:13:46 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id CCE66431FAE + for ; Sat, 31 Mar 2012 02:13:45 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1SDuNU-0000Ks-1z; Sat, 31 Mar 2012 10:13:44 +0100 +Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223] + helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) + (envelope-from ) + id 1SDuNT-0001LC-L3; Sat, 31 Mar 2012 10:13:43 +0100 +From: Mark Walters +To: Adam Wolfe Gordon , notmuch@notmuchmail.org +Subject: Re: [BUG/PATCH v2 1/2] emacs: Fix header problem in reply for emacs + 23.2 +In-Reply-To: <1333038410-17927-2-git-send-email-awg+notmuch@xvx.ca> +References: <1333038410-17927-1-git-send-email-awg+notmuch@xvx.ca> + <1333038410-17927-2-git-send-email-awg+notmuch@xvx.ca> +User-Agent: Notmuch/0.12+65~g8bf1842 (http://notmuchmail.org) Emacs/23.3.1 + (x86_64-pc-linux-gnu) +Date: Sat, 31 Mar 2012 10:13:53 +0100 +Message-ID: <87k42116b2.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 94.192.233.223 +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: f595d6809c5f3991d98c43a8d9f4ce2c (of first 20000 bytes) +X-SpamAssassin-Score: -1.8 +X-SpamAssassin-SpamBar: - +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored -1.8 points. + Summary of the scoring: + * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, + * medium trust + * [138.37.6.40 listed in list.dnswl.org] + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.5 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +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: Sat, 31 Mar 2012 09:13:46 -0000 + +Adam Wolfe Gordon writes: + +> 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. + +A few minor comments: + +I think this code applies on top of + id:"1332941635-21019-2-git-send-email-awg+notmuch@xvx.ca" and + id:"1332941635-21019-3-git-send-email-awg+notmuch@xvx.ca" + +Secondly it seems a little odd that the second patch above changes the +header stuff from 'From to "From" and then this patch changes it back +again. This is probably only a matter of a tidy history but I have to +admit I am confused about why the reply from alternate address still +works (but it does seem to) + +Finally, there is a trailing white-space in the second patch in this +series. + +Best wishes + +Mark + +> --- +> 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch