[PATCH] emacs: implement notmuch-search-color-line with dolist.
authorMatt Armstrong <marmstrong@google.com>
Sun, 14 Aug 2016 22:13:00 +0000 (15:13 +1700)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:22:27 +0000 (16:22 -0700)
95/16ed63d960c7f0ae426796521ac7c8416aeebe [new file with mode: 0644]

diff --git a/95/16ed63d960c7f0ae426796521ac7c8416aeebe b/95/16ed63d960c7f0ae426796521ac7c8416aeebe
new file mode 100644 (file)
index 0000000..6d59e02
--- /dev/null
@@ -0,0 +1,103 @@
+Return-Path: <marmstrong@google.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id C7DF16DE7714\r
+ for <notmuch@notmuchmail.org>; Sun, 14 Aug 2016 15:26:03 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.829\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.829 tagged_above=-999 required=5 tests=[AWL=0.002,\r
+  DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,\r
+ SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id hRZASXrySSIw for <notmuch@notmuchmail.org>;\r
+ Sun, 14 Aug 2016 15:25:55 -0700 (PDT)\r
+Received: from mail-pa0-f50.google.com (mail-pa0-f50.google.com\r
+ [209.85.220.50])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 35D036DE90AF\r
+ for <notmuch@notmuchmail.org>; Sun, 14 Aug 2016 15:13:20 -0700 (PDT)\r
+Received: by mail-pa0-f50.google.com with SMTP id ti13so11152661pac.0\r
+ for <notmuch@notmuchmail.org>; Sun, 14 Aug 2016 15:13:20 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\r
+ s=20120113; h=from:to:cc:subject:date:message-id;\r
+ bh=AdCdx6GDYSlK/uwmEb21oXOYsQFuA7C0Pl2JqUcryvM=;\r
+ b=PV+oiPpiFGuj9tQUlOCY/tqekCeCIsim8C+tBBjvVJAvWpJ3XrRCbxkWUExhN2AAH1\r
+ sFDQC1wpLdq0vd8vVYM3F2RISoHRt01XCN+4EjPUtTiL/uvylVq/6ecZIrxg076JC2bX\r
+ WHqhvPAVMw8oTOUHMlS9l8XUday/kl5Ptnio1y4TGUrV2WodthKp4I9ctVa6ebF3uSql\r
+ NaJ1QxqEO/MaxkyVJKHeRBqH+fnZN0TvTxCK9qPVaREOPQi/htdNASAgq/K74uw0h6EO\r
+ V4G4Y+L+G/QAtzYNb/yu5OorjEpG41D28BP0zJ8W5YFlY3+3Jfb/KNIZXyqd1FJJHAmd S4qw==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id;\r
+ bh=AdCdx6GDYSlK/uwmEb21oXOYsQFuA7C0Pl2JqUcryvM=;\r
+ b=XR57mVJm5irmpNLZQaSaFrjXTCQjCSz+o5Qiit/jk7a0BQRbg2UGr/nKEb6/vo44P7\r
+ rmumfHmjuYalwJ45S0tvWVHMn6TCeaTie9tYMORQWlJZ+ioecXUqsY6OQCHuy7bpoiyz\r
+ ANGgJlNES764rSexGhMj1BwaKld9fVKRbMGeXsoXCJU6FMGNdUUQyGeLMPCni86skBK5\r
+ 8bK+qqsgJ+2SVPTb9dHPcu4NXm+yuyyy6w5j7/elfQ7jTr0GRVh5Mz760cb/sBxAQWm/\r
+ sJL0uTiMDjIy9kCmcJU4pS4fgwO9BrsI+tpTGQA1rpSKZlSghr+lMlSJ0Qep/hRT+hiF\r
+ nfTw==\r
+X-Gm-Message-State:\r
+ AEkoouukNDf46O+ODXT9c8/CQ/Vcz8lgdkeR7IPq60lMCgsfTt744nJBiWhZHxMAK1GWUlWP\r
+X-Received: by 10.66.54.229 with SMTP id m5mr47955287pap.91.1471212799134;\r
+ Sun, 14 Aug 2016 15:13:19 -0700 (PDT)\r
+Received: from marmstrong-linux.kir.corp.google.com ([100.119.200.73])\r
+ by smtp.gmail.com with ESMTPSA id k66sm27955456pfc.30.2016.08.14.15.13.17\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\r
+ Sun, 14 Aug 2016 15:13:17 -0700 (PDT)\r
+From: Matt Armstrong <marmstrong@google.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: implement notmuch-search-color-line with dolist.\r
+Date: Sun, 14 Aug 2016 15:13:00 -0700\r
+Message-Id: <1471212780-11993-1-git-send-email-marmstrong@google.com>\r
+X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 14 Aug 2016 22:26:04 -0000\r
+\r
+While passing a lambda to mapc is idiomatic elisp, dolist is easier\r
+to understand, and there are a few other calls to it in this file.\r
+---\r
+ emacs/notmuch.el | 13 ++++++-------\r
+ 1 file changed, 6 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index 43d56f7..6307b37 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -700,13 +700,12 @@ background."\r
\r
+ (defun notmuch-search-color-line (start end line-tag-list)\r
+   "Colorize lines in `notmuch-show' based on tags."\r
+-  (mapc (lambda (elem)\r
+-        (let ((tag (car elem))\r
+-              (attributes (cdr elem)))\r
+-          (when (member tag line-tag-list)\r
+-            (notmuch-apply-face nil attributes nil start end))))\r
+-      ;; Reverse the list so earlier entries take precedence\r
+-      (reverse notmuch-search-line-faces)))\r
++  ;; Reverse the list so earlier entries take precedence\r
++  (dolist (elem (reverse notmuch-search-line-faces))\r
++    (let ((tag (car elem))\r
++        (face (cdr elem)))\r
++      (when (member tag line-tag-list)\r
++      (notmuch-apply-face nil face nil start end)))))\r
\r
+ (defun notmuch-search-author-propertize (authors)\r
+   "Split `authors' into matching and non-matching authors and\r
+-- \r
+2.8.0.rc3.226.g39d4020\r
+\r