From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 93198431FC2 for ; Tue, 3 Jul 2012 15:21:17 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 XGcWAp9iwmV0 for ; Tue, 3 Jul 2012 15:21:16 -0700 (PDT) Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU [18.9.25.15]) by olra.theworths.org (Postfix) with ESMTP id B8022431FCF for ; Tue, 3 Jul 2012 15:21:06 -0700 (PDT) X-AuditID: 1209190f-b7f306d0000008b4-bb-4ff37052d4c9 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP id 86.67.02228.25073FF4; Tue, 3 Jul 2012 18:21:06 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q63ML5Oc012633; Tue, 3 Jul 2012 18:21:05 -0400 Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q63ML1sH023219 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Tue, 3 Jul 2012 18:21:02 -0400 (EDT) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1SmBSu-0007fK-VV; Tue, 03 Jul 2012 18:21:00 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH 1/8] emacs: Clean up notmuch-search-show-result Date: Tue, 3 Jul 2012 18:20:52 -0400 Message-Id: <1341354059-29396-2-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1341354059-29396-1-git-send-email-amdragon@mit.edu> References: <1341354059-29396-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrEIsWRmVeSWpSXmKPExsUixCmqrBtU8Nnf4NFJEYsje2axWyw985/Z 4vrNmcwWb1bOY3Vg8dg56y67x+GvC1k8nq26xezR9GMxawBLFJdNSmpOZllqkb5dAlfG1pY3 TAU7BSuaXjeyNjCu5Oti5OSQEDCRODn1ICuELSZx4d56ti5GLg4hgX2MEg9efWKBcNYzShxf e5EVwjnJJPHr9zaozFxGiRXrTrOB9LMJaEhs27+cEcQWEZCW2Hl3NthcZoFcibOth8HiwgL2 Euv2LgKrZxFQldjwexUziM0r4CBx9tZWqDvkJZ7e7wOr4RRwlFhx8ywLiC0EVLPtQwfrBEb+ BYwMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3RN9HIzS/RSU0o3MYKDTpJ/B+O3g0qHGAU4GJV4 eJMUPvsLsSaWFVfmHmKU5GBSEuW9kgcU4kvKT6nMSCzOiC8qzUktPsQowcGsJMK7Ogkox5uS WFmVWpQPk5LmYFES572actNfSCA9sSQ1OzW1ILUIJivDwaEkwXsgH6hRsCg1PbUiLTOnBCHN xMEJMpwHaPgykBre4oLE3OLMdIj8KUZFKXHenSAJAZBERmkeXC8sKbxiFAd6RZj3KEgVDzCh wHW/AhrMBDQ4b/EnkMEliQgpqQbGJjZO/913f99fv+XbZka/2N964hdij6359lX1gFXuLPX5 10I0xE9dLUroe7GTObFkAnO/nP+hlF6HQiW1z6FzPEL1DJs9ZmtGT9e96vch9sGS3MojfOGT Pqcu//RQVJK9QXM/x/Vfn0t+W5RWHNQTuf3bclLvyqnf57Rfff1AQ7mgf2fXQZGdSizFGYmG WsxFxYkAZdWhvuUCAAA= Cc: tomi.ollila@iki.fi 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: Tue, 03 Jul 2012 22:21:17 -0000 This simplifies the code and makes it no longer cubic in the number of result fields. --- emacs/notmuch.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index c6236db..be217a2 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -707,29 +707,29 @@ non-authors is found, assume that all of the authors match." (overlay-put overlay 'isearch-open-invisible #'delete-overlay))) (insert padding)))) -(defun notmuch-search-insert-field (field date count authors subject tags) +(defun notmuch-search-insert-field (field format date count authors subject tags) (cond ((string-equal field "date") - (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) date) + (insert (propertize (format format date) 'face 'notmuch-search-date))) ((string-equal field "count") - (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) count) + (insert (propertize (format format count) 'face 'notmuch-search-count))) ((string-equal field "subject") - (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) subject) + (insert (propertize (format format subject) 'face 'notmuch-search-subject))) ((string-equal field "authors") - (notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors)) + (notmuch-search-insert-authors format authors)) ((string-equal field "tags") - (insert (concat "(" (propertize tags 'font-lock-face 'notmuch-tag-face) ")"))))) + (insert + (format format (propertize tags 'font-lock-face 'notmuch-tag-face)))))) (defun notmuch-search-show-result (date count authors subject tags) - (let ((fields) (field)) - (setq fields (mapcar 'car notmuch-search-result-format)) - (loop for field in fields - do (notmuch-search-insert-field field date count authors subject tags))) + (dolist (format notmuch-search-result-format) + (notmuch-search-insert-field (car format) (cdr format) + date count authors subject tags)) (insert "\n")) (defun notmuch-search-process-filter (proc string) -- 1.7.10