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 9E5264196F0 for ; Thu, 29 Apr 2010 02:10:55 -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 WJ3+B9Jtq0LS for ; Thu, 29 Apr 2010 02:10:54 -0700 (PDT) Received: from homiemail-a21.g.dreamhost.com (caiajhbdccah.dreamhost.com [208.97.132.207]) by olra.theworths.org (Postfix) with ESMTP id D24D7431FC1 for ; Thu, 29 Apr 2010 02:10:54 -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-a21.g.dreamhost.com (Postfix) with ESMTPA id 8267A300061; Thu, 29 Apr 2010 02:10:47 -0700 (PDT) From: Sebastian Spaeth To: Notmuch developer list Subject: [PATCH v2] emacs: Reuse rather than reinvent message header filtering Date: Thu, 29 Apr 2010 11:10:01 +0200 Message-Id: <1272532201-8742-1-git-send-email-Sebastian@SSpaeth.de> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <87eihyy6od.fsf@ut.hh.sledj.net> References: <87eihyy6od.fsf@ut.hh.sledj.net> 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 09:10:55 -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 it. 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. Also remove the (require 'cl), the only reason for its existence was the now removed "loop" function. Signed-off-by: Sebastian Spaeth --- Also removed (require 'cl) as per dme's suggestion. emacs/notmuch-mua.el | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-) diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el index bd06e3c..0975fe6 100644 --- a/emacs/notmuch-mua.el +++ b/emacs/notmuch-mua.el @@ -19,7 +19,6 @@ ;; ;; Authors: David Edmondson -(require 'cl) (require 'message) (require 'notmuch-lib) @@ -92,12 +91,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