From: Adam Wolfe Gordon Date: Wed, 28 Mar 2012 13:33:55 +0000 (+1800) Subject: [BUG/PATCH v2 2/2] emacs: Fix replying from alternate addresses X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=bbdc5983617a508354f7b286721e5a207ee33cbc;p=notmuch-archives.git [BUG/PATCH v2 2/2] emacs: Fix replying from alternate addresses --- diff --git a/3f/6938bf43bc41afecf311d4fa4895bca2b0a91f b/3f/6938bf43bc41afecf311d4fa4895bca2b0a91f new file mode 100644 index 000000000..8d93b1ebd --- /dev/null +++ b/3f/6938bf43bc41afecf311d4fa4895bca2b0a91f @@ -0,0 +1,110 @@ +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 DA167431FBF + for ; Wed, 28 Mar 2012 06:33:59 -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 RORpNxCYrT3G for ; + Wed, 28 Mar 2012 06:33:59 -0700 (PDT) +Received: from idcmail-mo1so.shaw.ca (idcmail-mo1so.shaw.ca [24.71.223.10]) + by olra.theworths.org (Postfix) with ESMTP id 08AA5431FAE + for ; Wed, 28 Mar 2012 06:33:58 -0700 (PDT) +Received: from pd2ml2so-ssvc.prod.shaw.ca ([10.0.141.134]) + by pd2mo1so-svcs.prod.shaw.ca with ESMTP; 28 Mar 2012 07:33:58 -0600 +X-Cloudmark-SP-Filtered: true +X-Cloudmark-SP-Result: v=1.1 cv=FBhiVrZmCxhz+jlnxOWeJaR14+PwdUeacMZGNnSzbtQ= + c=1 sm=1 + a=orNGVW25YFkA:10 a=BLceEmwcHowA:10 a=yQp6g8lIsgqumF79BAsFDg==:17 + a=A1X0JdhQAAAA:8 a=7343-z1_AAAA:8 a=kruYVQ-tQJgX6LSJxeAA:9 + a=ErgTTcISGBnhqq40-fwA:7 a=Y6qChIQXU1wA:10 a=0c-eHkXYtrgA:10 + a=WJfXdXBIiwVsjGxf:21 a=TlY5ANsmuuyg24_V:21 + a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 +Received: from unknown (HELO lagos.xvx.ca) ([96.52.216.56]) + by pd2ml2so-dmz.prod.shaw.ca with ESMTP; 28 Mar 2012 07:33:58 -0600 +Received: by lagos.xvx.ca (Postfix, from userid 1000) + id DE38B800422C; Wed, 28 Mar 2012 07:33:57 -0600 (MDT) +From: Adam Wolfe Gordon +To: notmuch@notmuchmail.org +Subject: [BUG/PATCH v2 2/2] emacs: Fix replying from alternate addresses +Date: Wed, 28 Mar 2012 07:33:55 -0600 +Message-Id: <1332941635-21019-3-git-send-email-awg+notmuch@xvx.ca> +X-Mailer: git-send-email 1.7.5.4 +In-Reply-To: <1332941635-21019-1-git-send-email-awg+notmuch@xvx.ca> +References: <1332635232-15269-1-git-send-email-awg+notmuch@xvx.ca> + <1332941635-21019-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: Wed, 28 Mar 2012 13:34:00 -0000 + +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. +--- + 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 3402efb..06291d3 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 + +-- +1.7.5.4 +