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