From e00da0da64fb8186c53a42cf12f7c24d6838219c Mon Sep 17 00:00:00 2001 From: Dmitry Kurochkin Date: Mon, 26 Mar 2012 21:02:25 +0400 Subject: [PATCH] Re: [BUG/PATCH 2/2] emacs: Fix replying from alternate addresses --- 5d/0d92fae6cf9d76ead7a43c7c9cdc4acc77eb1a | 130 ++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 5d/0d92fae6cf9d76ead7a43c7c9cdc4acc77eb1a diff --git a/5d/0d92fae6cf9d76ead7a43c7c9cdc4acc77eb1a b/5d/0d92fae6cf9d76ead7a43c7c9cdc4acc77eb1a new file mode 100644 index 000000000..a5a4630bf --- /dev/null +++ b/5d/0d92fae6cf9d76ead7a43c7c9cdc4acc77eb1a @@ -0,0 +1,130 @@ +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 102D7431FAF + for ; Mon, 26 Mar 2012 10:04:05 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, 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 f7VyfA7MxSsz for ; + Mon, 26 Mar 2012 10:04:04 -0700 (PDT) +Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com + [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 5B617431FAE + for ; Mon, 26 Mar 2012 10:04:04 -0700 (PDT) +Received: by bkwj4 with SMTP id j4so4830945bkw.26 + for ; Mon, 26 Mar 2012 10:04:03 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:subject:in-reply-to:references:date:message-id:mime-version + :content-type; bh=VLxhMZ73SDfOdjyV6ahbHx697yC2hNF4XWqPgKyQKDg=; + b=y78DAbBHtMsSS03utD5prCV/tCsrTlMOAoYAnZPcNk6wAlfUSsrYMLGeO9mdJRLDDK + 0q5zrkUVHhcl5se9Sc4LTXL5umJWXTi4d8f9QRPHw34OJBObhYSU+0lTcrjOB7FX6at4 + Da8kG+jWoB1EebL+20ZcU4hKNOWOOwOioROcF+G89+jy8BiXP05ceuc8Uhm5Yzxfg/Up + ga9q++f/3qYku5zsb9WteKeVqYOureJBcsKC9rE/79nzhgKA2x2MZl4Efgq7bOx0agXo + FbAukSQa/ZolEZcQX0DfqBHZ/5hO+TOofgUZbaL+O3uPtyA1sRXfHwsLtDVGaIsKI51Z + iQOQ== +Received: by 10.204.152.12 with SMTP id e12mr8870712bkw.29.1332781442982; + Mon, 26 Mar 2012 10:04:02 -0700 (PDT) +Received: from localhost ([91.144.186.21]) + by mx.google.com with ESMTPS id u5sm33772259bka.5.2012.03.26.10.04.01 + (version=TLSv1/SSLv3 cipher=OTHER); + Mon, 26 Mar 2012 10:04:02 -0700 (PDT) +From: Dmitry Kurochkin +To: Adam Wolfe Gordon , notmuch@notmuchmail.org +Subject: Re: [BUG/PATCH 2/2] emacs: Fix replying from alternate addresses +In-Reply-To: <1332635232-15269-3-git-send-email-awg+notmuch@xvx.ca> +References: <1332635232-15269-1-git-send-email-awg+notmuch@xvx.ca> + <1332635232-15269-3-git-send-email-awg+notmuch@xvx.ca>User-Agent: + Notmuch/0.12+70~g06ecbeb (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Mon, 26 Mar 2012 21:02:25 +0400 +Message-ID: <878vinjnxa.fsf@gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +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: Mon, 26 Mar 2012 17:04:05 -0000 + +Adam Wolfe Gordon writes: +> The bug was that notmuch-mua-mail used `mail-header` to check whether +> it was passed a "From" header. The implementation of `mail-header` +> must try to compare symbols instead of strings when looking for +> headers, as it was returning nil when a From header was present. This +> is probably because the mail functions construct headers as alists +> with symbols for the header names, while our code uses strings for the +> header names. +> +> Since we don't use `mail-header` anywhere else, and `message-mail` is +> perfectly happy to accept string header names, the fix is just to use +> `assoc` to look for the From header, so that the strings get compared +> properly. +> --- + +LGTM. Thanks for fixing this. + +Regards, + Dmitry + +> emacs/notmuch-mua.el | 4 ++-- +> test/emacs | 1 - +> 2 files changed, 2 insertions(+), 3 deletions(-) +> +> diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el +> index 6aae3a0..9805d79 100644 +> --- a/emacs/notmuch-mua.el +> +++ b/emacs/notmuch-mua.el +> @@ -187,7 +187,7 @@ OTHER-ARGS are passed through to `message-mail'." +> (when (not (string= "" user-agent)) +> (push (cons "User-Agent" user-agent) other-headers)))) +> +> - (unless (mail-header 'From other-headers) +> + (unless (assoc "From" other-headers) +> (push (cons "From" (concat +> (notmuch-user-name) " <" (notmuch-user-primary-email) ">")) other-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) +> diff --git a/test/emacs b/test/emacs +> index fa5d706..08db1ee 100755 +> --- a/test/emacs +> +++ b/test/emacs +> @@ -275,7 +275,6 @@ EOF +> test_expect_equal_file OUTPUT EXPECTED +> +> test_begin_subtest "Reply from alternate address within emacs" +> -test_subtest_known_broken +> add_message '[from]="Sender "' \ +> [to]=test_suite_other@notmuchmail.org \ +> [subject]=notmuch-reply-test \ +> -- +> 1.7.5.4 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2