[BUG/PATCH 2/2] emacs: Fix replying from alternate addresses

Adam Wolfe Gordon awg+notmuch at xvx.ca
Sat Mar 24 17:27:12 PDT 2012


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 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 <sender at example.com>"' \
 	     [to]=test_suite_other at notmuchmail.org \
 	     [subject]=notmuch-reply-test \
-- 
1.7.5.4



More information about the notmuch mailing list