[PATCH v2 1/9] emacs: Clean up notmuch-search-show-result
authorAustin Clements <amdragon@MIT.EDU>
Thu, 5 Jul 2012 20:52:19 +0000 (16:52 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:01 +0000 (09:48 -0800)
d5/171a722dcdecdb7f4339bd2a85faf8a75d711c [new file with mode: 0644]

diff --git a/d5/171a722dcdecdb7f4339bd2a85faf8a75d711c b/d5/171a722dcdecdb7f4339bd2a85faf8a75d711c
new file mode 100644 (file)
index 0000000..c42c731
--- /dev/null
@@ -0,0 +1,127 @@
+Return-Path: <amdragon@mit.edu>\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 0BC2E431FBF\r
+       for <notmuch@notmuchmail.org>; Thu,  5 Jul 2012 13:52:50 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 LZi13+giW8MX for <notmuch@notmuchmail.org>;\r
+       Thu,  5 Jul 2012 13:52:48 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-8.mit.edu (DMZ-MAILSEC-SCANNER-8.MIT.EDU\r
+       [18.7.68.37])\r
+       by olra.theworths.org (Postfix) with ESMTP id F310D431FC9\r
+       for <notmuch@notmuchmail.org>; Thu,  5 Jul 2012 13:52:43 -0700 (PDT)\r
+X-AuditID: 12074425-b7f9b6d0000008c4-89-4ff5fe9be8f0\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 2E.07.02244.B9EF5FF4; Thu,  5 Jul 2012 16:52:43 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q65Kqgr8024133; \r
+       Thu, 5 Jul 2012 16:52:42 -0400\r
+Received: from drake.dyndns.org (26-4-182.dynamic.csail.mit.edu [18.26.4.182])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q65KqbV7027234\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Thu, 5 Jul 2012 16:52:39 -0400 (EDT)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1Smt2T-0004XU-Gh; Thu, 05 Jul 2012 16:52:37 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 1/9] emacs: Clean up notmuch-search-show-result\r
+Date: Thu,  5 Jul 2012 16:52:19 -0400\r
+Message-Id: <1341521547-15502-2-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1341521547-15502-1-git-send-email-amdragon@mit.edu>\r
+References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
+       <1341521547-15502-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrOIsWRmVeSWpSXmKPExsUixCmqrDv731d/g2NXRC1Wz+WxuH5zJrPF\r
+       m5XzWB2YPXbOusvucfjrQhaPZ6tuMQcwR3HZpKTmZJalFunbJXBlPHx5mLXgoWDF0QnXmRoY\r
+       T/N1MXJySAiYSCyb/4oZwhaTuHBvPVsXIxeHkMA+RomOXVuZIZz1jBLTfm1nhHBOMkn0njoN\r
+       lZnLKPGkezobSD+bgIbEtv3LGUFsEQFpiZ13Z7OC2MwCcRJbpvwHiwsLOEk8/32HBcRmEVCV\r
+       uLxlLVicV8BB4kTbeVaIO+Qlnt7vA5vJKeAocWHiYrAaIYFyiT9L/rFMYORfwMiwilE2JbdK\r
+       NzcxM6c4NVm3ODkxLy+1SNdCLzezRC81pXQTIyi82F1UdzBOOKR0iFGAg1GJh9co94u/EGti\r
+       WXFl7iFGSQ4mJVHext9f/YX4kvJTKjMSizPii0pzUosPMUpwMCuJ8PZmAOV4UxIrq1KL8mFS\r
+       0hwsSuK8N1Ju+gsJpCeWpGanphakFsFkZTg4lCR4n/4FahQsSk1PrUjLzClBSDNxcIIM5wEa\r
+       /gKkhre4IDG3ODMdIn+KUVFKnPc6SEIAJJFRmgfXC4v/V4ziQK8I834CqeIBpg647ldAg5mA\r
+       Buct/gQyuCQRISXVwDjB7OdEOTbxTS9FQyKDDh+y+r2qJ8N1aUCbmqL1fK+s6PyK1JSV/QYH\r
+       Jh/89PCTl3HSk7Q3SZ/dTP36MnXnF+Ra7FsRHM4meSdix/Lwh1WXGTn3vpjuuH7G0wdr1oUx\r
+       HzTb5//fsSxRz+RL1usrh1/lT2nre3Gv8GTz1JhaF81PGwuv8UgxmyuxFGckGmoxFxUnAgA0\r
+       k3Do2gIAAA==\r
+Cc: tomi.ollila@iki.fi\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, 05 Jul 2012 20:52:50 -0000\r
+\r
+This simplifies the code and makes it no longer cubic in the number of\r
+result fields.\r
+---\r
+ emacs/notmuch.el |   19 ++++++++++---------\r
+ 1 file changed, 10 insertions(+), 9 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index c6236db..8ad0b68 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -707,29 +707,30 @@ non-authors is found, assume that all of the authors match."\r
+         (overlay-put overlay 'isearch-open-invisible #'delete-overlay)))\r
+       (insert padding))))\r
\r
+-(defun notmuch-search-insert-field (field date count authors subject tags)\r
++(defun notmuch-search-insert-field (field format-string date count authors subject tags)\r
+   (cond\r
+    ((string-equal field "date")\r
+-    (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) date)\r
++    (insert (propertize (format format-string date)\r
+                       'face 'notmuch-search-date)))\r
+    ((string-equal field "count")\r
+-    (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) count)\r
++    (insert (propertize (format format-string count)\r
+                       'face 'notmuch-search-count)))\r
+    ((string-equal field "subject")\r
+-    (insert (propertize (format (cdr (assoc field notmuch-search-result-format)) subject)\r
++    (insert (propertize (format format-string subject)\r
+                       'face 'notmuch-search-subject)))\r
\r
+    ((string-equal field "authors")\r
+-    (notmuch-search-insert-authors (cdr (assoc field notmuch-search-result-format)) authors))\r
++    (notmuch-search-insert-authors format-string authors))\r
\r
+    ((string-equal field "tags")\r
++    ;; Ignore format-string here because notmuch-search-set-tags\r
++    ;; depends on the format of this\r
+     (insert (concat "(" (propertize tags 'font-lock-face 'notmuch-tag-face) ")")))))\r
\r
+ (defun notmuch-search-show-result (date count authors subject tags)\r
+-  (let ((fields) (field))\r
+-    (setq fields (mapcar 'car notmuch-search-result-format))\r
+-    (loop for field in fields\r
+-        do (notmuch-search-insert-field field date count authors subject tags)))\r
++  (dolist (spec notmuch-search-result-format)\r
++    (notmuch-search-insert-field (car spec) (cdr spec)\r
++                               date count authors subject tags))\r
+   (insert "\n"))\r
\r
+ (defun notmuch-search-process-filter (proc string)\r
+-- \r
+1.7.10\r
+\r