[PATCH v3 1/9] emacs: Clean up notmuch-search-show-result
authorAustin Clements <amdragon@MIT.EDU>
Mon, 9 Jul 2012 21:42:34 +0000 (17:42 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:05 +0000 (09:48 -0800)
dc/25efde5c405026a27f9f7591c24184a4606308 [new file with mode: 0644]

diff --git a/dc/25efde5c405026a27f9f7591c24184a4606308 b/dc/25efde5c405026a27f9f7591c24184a4606308
new file mode 100644 (file)
index 0000000..c3201e1
--- /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 4A6F4429E30\r
+       for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 14:42: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 FhmWRwzvvsTq for <notmuch@notmuchmail.org>;\r
+       Mon,  9 Jul 2012 14:42:49 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
+       [18.9.25.15])\r
+       by olra.theworths.org (Postfix) with ESMTP id 61D9F431FBF\r
+       for <notmuch@notmuchmail.org>; Mon,  9 Jul 2012 14:42:49 -0700 (PDT)\r
+X-AuditID: 1209190f-b7f306d0000008b4-17-4ffb50588fe4\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 0A.0F.02228.8505BFF4; Mon,  9 Jul 2012 17:42:48 -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 q69LglVQ011259; \r
+       Mon, 9 Jul 2012 17:42:47 -0400\r
+Received: from drake.dyndns.org (26-4-176.dynamic.csail.mit.edu [18.26.4.176])\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 q69LgiYZ022682\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Mon, 9 Jul 2012 17:42:45 -0400 (EDT)\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1SoLj9-0004fo-Vs; Mon, 09 Jul 2012 17:42:43 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 1/9] emacs: Clean up notmuch-search-show-result\r
+Date: Mon,  9 Jul 2012 17:42:34 -0400\r
+Message-Id: <1341870162-17782-2-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1341870162-17782-1-git-send-email-amdragon@mit.edu>\r
+References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
+       <1341870162-17782-1-git-send-email-amdragon@mit.edu>\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixCmqrBsR8Nvf4OEaTYvVc3ksrt+cyWzx\r
+       ZuU8Vgdmj52z7rJ7HP66kMXj2apbzAHMUVw2Kak5mWWpRfp2CVwZD18eZi14KFhxdMJ1pgbG\r
+       03xdjJwcEgImEo9e3WOEsMUkLtxbz9bFyMUhJLCPUeL57MlMEM56RondbV9YIZyTTBJ3T35l\r
+       hnDmMkrc/ruFDaSfTUBDYtv+5WCzRASkJXbenc0KYjMLxElsmfIfKM7BISzgJPF1dTZImEVA\r
+       VWLphBtMIDavgIPEp9YWJogz5CWe3u8DG8kp4Cgx5+YOsJFCAuUSn2/8Y57AyL+AkWEVo2xK\r
+       bpVubmJmTnFqsm5xcmJeXmqRrolebmaJXmpK6SZGcHBJ8u9g/HZQ6RCjAAejEg/vJpbf/kKs\r
+       iWXFlbmHGCU5mJREefM8gUJ8SfkplRmJxRnxRaU5qcWHGCU4mJVEeG+5AuV4UxIrq1KL8mFS\r
+       0hwsSuK8V1Nu+gsJpCeWpGanphakFsFkZTg4lCR4p/kDNQoWpaanVqRl5pQgpJk4OEGG8wAN\r
+       nwBSw1tckJhbnJkOkT/FqCglzjsZJCEAksgozYPrhUX/K0ZxoFeEeYtAqniAiQOu+xXQYCag\r
+       we09v0AGlyQipKQaGLOPvfh+5Zp+a9Fcr5+idrOm3q44YjanzVmYrfUE31TxjRoBx5jL/QKv\r
+       CT54G/jupDSH3LXKuj012VczwtLenV854fIUwVbpuCM30hisX0w54LPa34Mr1ub4/7feM16c\r
+       Dn3c/kipc2fFd7GYFrZr7XnmwVJrPVhPbzxq83BOb8yzV4HuQZ/eP1ViKc5INNRiLipOBACj\r
+       OpOa2QIAAA==\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: Mon, 09 Jul 2012 21:42: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