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