From 9007a86a9692c37a9668714991529e9f6731b8b0 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 11 Jan 2014 21:41:42 +0000 Subject: [PATCH] [PATCH 1/2] emacs: tree: default face for matching/non-matching messages --- f6/268e6a82c544c12b0bbf8a0945ef73eef46499 | 176 ++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 f6/268e6a82c544c12b0bbf8a0945ef73eef46499 diff --git a/f6/268e6a82c544c12b0bbf8a0945ef73eef46499 b/f6/268e6a82c544c12b0bbf8a0945ef73eef46499 new file mode 100644 index 000000000..55e6153ea --- /dev/null +++ b/f6/268e6a82c544c12b0bbf8a0945ef73eef46499 @@ -0,0 +1,176 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 5A090431FC3 + for ; Sat, 11 Jan 2014 13:42:03 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + 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 Tbz-dVxztrEv for ; + Sat, 11 Jan 2014 13:41:56 -0800 (PST) +Received: from mail-we0-f175.google.com (mail-we0-f175.google.com + [74.125.82.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 9E630431FD0 + for ; Sat, 11 Jan 2014 13:41:56 -0800 (PST) +Received: by mail-we0-f175.google.com with SMTP id p61so113223wes.20 + for ; Sat, 11 Jan 2014 13:41:52 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:in-reply-to:references; + bh=cNt7MSxwWZEo1TF7/8WRLuR/w8/2+lcHDIUevzQ0ZpM=; + b=Fmq7GkNxZlozZlzYIP+m5gnV09wwyKXnqROx9w5YxV5EC2aPuDjfU62r11WOBDq/cx + F6h4b32dnSYNtZJ16bHiKId1mTrTBqUzToW2y0zKQCTWigBe98VmcTbLRwQ/piSE6yiV + Iwj6gtOSoiyrIy0Rui7s9v6ffwGsyB5597uHPYqfwygFHn53uvh1sSTsa4IU3/KhXnPF + i1sQ22LqmmHLnA7tlhNZ4+27XdFfPmDK/H/px0aquqLNo+IjJzDI9/Q0YhVUY24IClYE + aSK6barXbNocXPQumuREnIv6pxd1TDa1voR/JaYIL5QG7V+iVwuxGEBZdCOVYX7ibCnf + N4gA== +X-Received: by 10.180.89.193 with SMTP id bq1mr8743437wib.22.1389476512788; + Sat, 11 Jan 2014 13:41:52 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id po3sm7519383wjc.3.2014.01.11.13.41.52 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 11 Jan 2014 13:41:52 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 1/2] emacs: tree: default face for matching/non-matching + messages +Date: Sat, 11 Jan 2014 21:41:42 +0000 +Message-Id: <1389476503-23682-2-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1389476503-23682-1-git-send-email-markwalters1009@gmail.com> +References: <1389476503-23682-1-git-send-email-markwalters1009@gmail.com> +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: Sat, 11 Jan 2014 21:42:03 -0000 + +This adds default faces for matching and non-matching messages. This +makes it easier for a user to do broad customization without having to +customize every field. It also fits more neatly with the next patch +which switches to using notmuch-tag-format-tags for tag formatting. + +We set the field specific face customization to nil for all the fields +which use the message default face to make it clear to a user which +fields customizations are being used. +--- + emacs/notmuch-tree.el | 36 ++++++++++++++++++++++++++---------- + 1 files changed, 26 insertions(+), 10 deletions(-) + +diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el +index 0ce7fa8..16f2862 100644 +--- a/emacs/notmuch-tree.el ++++ b/emacs/notmuch-tree.el +@@ -70,8 +70,14 @@ Note the author string should not contain + :group 'notmuch-tree) + + ;; Faces for messages that match the query. +-(defface notmuch-tree-match-date-face ++(defface notmuch-tree-match-face + '((t :inherit default)) ++ "Default face used in tree mode face for matching messages" ++ :group 'notmuch-tree ++ :group 'notmuch-faces) ++ ++(defface notmuch-tree-match-date-face ++ nil + "Face used in tree mode for the date in messages matching the query." + :group 'notmuch-tree + :group 'notmuch-faces) +@@ -90,13 +96,13 @@ Note the author string should not contain + :group 'notmuch-faces) + + (defface notmuch-tree-match-subject-face +- '((t :inherit default)) ++ nil + "Face used in tree mode for the subject in messages matching the query." + :group 'notmuch-tree + :group 'notmuch-faces) + + (defface notmuch-tree-match-tree-face +- '((t :inherit default)) ++ nil + "Face used in tree mode for the thread tree block graphics in messages matching the query." + :group 'notmuch-tree + :group 'notmuch-faces) +@@ -115,32 +121,38 @@ Note the author string should not contain + :group 'notmuch-faces) + + ;; Faces for messages that do not match the query. +-(defface notmuch-tree-no-match-date-face ++(defface notmuch-tree-no-match-face + '((t (:foreground "gray"))) ++ "Default face used in tree mode face for non-matching messages" ++ :group 'notmuch-tree ++ :group 'notmuch-faces) ++ ++(defface notmuch-tree-no-match-date-face ++ nil + "Face used in tree mode for non-matching dates." + :group 'notmuch-tree + :group 'notmuch-faces) + + (defface notmuch-tree-no-match-subject-face +- '((t (:foreground "gray"))) ++ nil + "Face used in tree mode for non-matching subjects." + :group 'notmuch-tree + :group 'notmuch-faces) + + (defface notmuch-tree-no-match-tree-face +- '((t (:foreground "gray"))) ++ nil + "Face used in tree mode for the thread tree block graphics in messages matching the query." + :group 'notmuch-tree + :group 'notmuch-faces) + + (defface notmuch-tree-no-match-author-face +- '((t (:foreground "gray"))) ++ nil + "Face used in tree mode for the date in messages matching the query." + :group 'notmuch-tree + :group 'notmuch-faces) + + (defface notmuch-tree-no-match-tag-face +- '((t (:foreground "gray"))) ++ nil + "Face used in tree mode face for non-matching tags." + :group 'notmuch-tree + :group 'notmuch-faces) +@@ -699,10 +711,14 @@ unchanged ADDRESS if parsing fails." + + (defun notmuch-tree-format-field-list (field-list msg) + "Format fields of MSG according to FIELD-LIST and return string" +- (let (result-string) ++ (let ((face (if (plist-get msg :match) ++ 'notmuch-tree-match-face ++ 'notmuch-tree-no-match-face)) ++ (result-string)) + (dolist (spec field-list result-string) + (let ((field-string (notmuch-tree-format-field (car spec) (cdr spec) msg))) +- (setq result-string (concat result-string field-string)))))) ++ (setq result-string (concat result-string field-string)))) ++ (notmuch-combine-face-text-property-string result-string face t))) + + (defun notmuch-tree-insert-msg (msg) + "Insert the message MSG according to notmuch-tree-result-format" +-- +1.7.9.1 + -- 2.26.2