From 9f7ac7ccc94855182732af1403c8304b6068a410 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Thu, 29 Mar 2012 14:13:05 +0000 Subject: [PATCH] Re: [BUG/PATCH] emacs: Fix header problem in reply for emacs 23.2 --- 23/f54e391300a5ff70bd2d61886ee87d29cd968a | 151 ++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 23/f54e391300a5ff70bd2d61886ee87d29cd968a diff --git a/23/f54e391300a5ff70bd2d61886ee87d29cd968a b/23/f54e391300a5ff70bd2d61886ee87d29cd968a new file mode 100644 index 000000000..1a8f005ee --- /dev/null +++ b/23/f54e391300a5ff70bd2d61886ee87d29cd968a @@ -0,0 +1,151 @@ +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 C8B45431FAF + for ; Thu, 29 Mar 2012 07:13:12 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 SG+sn24pCGau for ; + Thu, 29 Mar 2012 07:13:12 -0700 (PDT) +Received: from mail-qa0-f53.google.com (mail-qa0-f53.google.com + [209.85.216.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 0F933431FAE + for ; Thu, 29 Mar 2012 07:13:12 -0700 (PDT) +Received: by qadc11 with SMTP id c11so124027qad.5 + for ; Thu, 29 Mar 2012 07:13:10 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=from:to:cc:subject:in-reply-to:references:user-agent:date + :message-id:mime-version:content-type:x-gm-message-state; + bh=366vsB9IN8iXqjgp2BNCRN50x9e8I2V+HTvMft6/KBs=; + b=Ub4HUldc7zaHF/aYfWqOa9BDODUNVrW2Qr7qYFtwtjoV73uhjFIlDUKBTR5PDWbzqI + I14GQe3DaQIIVS0Tku600p4FT95kREO5+rQWLlSowInl52+IMs/RWXTDNxjsimd/x021 + x8VicJ/c/OaFvV2san0BomuBiybXuDxfepFUgQMlFda4X7CzHkRA4jAExnE9xSkAar6m + pXqHGrwXpVHByfJbHcU4OI3to24keGRaj4X/WauYm6Tja6Ec3KnTeekC2ZKs72kc79Xm + gTnT5OIwNDnLzpThRwtQeVlD8YBW2+pHzXmc9v3a2NGgB7bYxJudU2Zr2mkDNeJuqdiW + DbPg== +Received: by 10.229.77.36 with SMTP id e36mr12995489qck.138.1333030389983; + Thu, 29 Mar 2012 07:13:09 -0700 (PDT) +Received: from localhost (nikula.org. [92.243.24.172]) + by mx.google.com with ESMTPS id i19sm12578484qad.19.2012.03.29.07.13.07 + (version=SSLv3 cipher=OTHER); Thu, 29 Mar 2012 07:13:08 -0700 (PDT) +From: Jani Nikula +To: Adam Wolfe Gordon , notmuch@notmuchmail.org +Subject: Re: [BUG/PATCH] emacs: Fix header problem in reply for emacs 23.2 +In-Reply-To: <1332943338-9708-1-git-send-email-awg+notmuch@xvx.ca> +References: <87obrh3ufi.fsf@nikula.org> + <1332943338-9708-1-git-send-email-awg+notmuch@xvx.ca> +User-Agent: Notmuch/0.11.1+222~ga47a98c (http://notmuchmail.org) Emacs/23.1.1 + (i686-pc-linux-gnu) +Date: Thu, 29 Mar 2012 14:13:05 +0000 +Message-ID: <87398rebri.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Gm-Message-State: + ALoCoQk6jZ5ER2Zxjiu7bOBVWE90A2WhSi0kMZrp2ODBPzxMtmV96LtgEV7B2iJCssv0ut9Ywp7I +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 14:13:13 -0000 + +On Wed, 28 Mar 2012 08:02:18 -0600, Adam Wolfe Gordon wrote: +> 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. + +The patch depends on some set of the other reply fixes (*), so I applied +this on top of them. All tests pass with emacs 23.2. + +Unfortunately, the emacs UI fails with "Symbol's function definition is +void: remove-if" when trying to reply. After a manual (require 'cl) the +UI seems to otherwise work as expected. This is probably unrelated to +this particular patch, but why is it a (eval-when-compile (require 'cl)) +and not (require 'cl) in notmuch-mua.el? + + +BR, +Jani. + + +(*) +id:"1332941635-21019-2-git-send-email-awg+notmuch@xvx.ca" +id:"1332941635-21019-3-git-send-email-awg+notmuch@xvx.ca" +id:"1332996818-15700-1-git-send-email-awg+notmuch@xvx.ca" + +> --- +> emacs/notmuch-lib.el | 5 ++++- +> emacs/notmuch-mua.el | 10 +++++----- +> 2 files changed, 9 insertions(+), 6 deletions(-) +> +> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el +> index c146748..af46611 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))) +> +> +;; 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-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..24918d3 100644 +> --- a/emacs/notmuch-mua.el +> +++ b/emacs/notmuch-mua.el +> @@ -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