--- /dev/null
+Return-Path: <Sebastian@SSpaeth.de>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 9C9C24196F0\r
+ for <notmuch@notmuchmail.org>; Thu, 29 Apr 2010 01:48:05 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+ tests=[BAYES_00=-1.9] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id L14YbbuiIaq3 for <notmuch@notmuchmail.org>;\r
+ Thu, 29 Apr 2010 01:48:04 -0700 (PDT)\r
+Received: from homiemail-a20.g.dreamhost.com (caiajhbdcaib.dreamhost.com\r
+ [208.97.132.81])\r
+ by olra.theworths.org (Postfix) with ESMTP id 4E086431FC1\r
+ for <notmuch@notmuchmail.org>; Thu, 29 Apr 2010 01:48:04 -0700 (PDT)\r
+Received: from localhost.localdomain (mtec-hg-docking-1-dhcp-204.ethz.ch\r
+ [129.132.133.204]) (Authenticated sender: sebastian@sspaeth.de)\r
+ by homiemail-a20.g.dreamhost.com (Postfix) with ESMTPA id E366C7EC06A; \r
+ Thu, 29 Apr 2010 01:47:58 -0700 (PDT)\r
+From: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
+To: Notmuch developer list <notmuch@notmuchmail.org>\r
+Subject: [PATCH] emacs: Reuse rather than reinvent message header filtering\r
+Date: Thu, 29 Apr 2010 10:47:55 +0200\r
+Message-Id: <1272530875-7141-1-git-send-email-Sebastian@SSpaeth.de>\r
+X-Mailer: git-send-email 1.7.0.4\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 29 Apr 2010 08:48:05 -0000\r
+\r
+In notmuch-mua-reply we were filtering out the Subject and To headers\r
+manually in a loop, but message mode offers a nice function for\r
+exactly that. Simplify the code by using that. Also, as\r
+notmuch-mua-mail already sorts and hides headers that we want sorted\r
+and hidden, we can safely remove those 2 functions from here as well.\r
+\r
+Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
+---\r
+ emacs/notmuch-mua.el | 7 +------\r
+ 1 files changed, 1 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el\r
+index bd06e3c..6318c15 100644\r
+--- a/emacs/notmuch-mua.el\r
++++ b/emacs/notmuch-mua.el\r
+@@ -92,12 +92,7 @@ list."\r
+ ((same-window-regexps '("\\*mail .*")))\r
+ (notmuch-mua-mail (mail-header 'to headers)\r
+ (mail-header 'subject headers)\r
+- (loop for header in headers\r
+- if (not (or (eq 'to (car header))\r
+- (eq 'subject (car header))))\r
+- collect header)))\r
+- (message-sort-headers)\r
+- (message-hide-headers)\r
++ (message-headers-to-generate headers t '(to subject))))\r
+ ;; insert the message body - but put it in front of the signature\r
+ ;; if one is present\r
+ (goto-char (point-max))\r
+-- \r
+1.7.0.4\r
+\r