From: Mark Walters Date: Thu, 19 Dec 2013 19:12:24 +0000 (+0000) Subject: [PATCH 2/2] emacs: tree: use tag-format-tags X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0d67b2b11ebefe4c4f4974827d89fbfec7d49159;p=notmuch-archives.git [PATCH 2/2] emacs: tree: use tag-format-tags --- diff --git a/8a/676ed01ae0f0067b47f6e0ffb53c378c108a38 b/8a/676ed01ae0f0067b47f6e0ffb53c378c108a38 new file mode 100644 index 000000000..7cd0086ac --- /dev/null +++ b/8a/676ed01ae0f0067b47f6e0ffb53c378c108a38 @@ -0,0 +1,133 @@ +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 8ED4C431FD8 + for ; Thu, 19 Dec 2013 11:12:49 -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 RztXHrTcSlSd for ; + Thu, 19 Dec 2013 11:12:43 -0800 (PST) +Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com + [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 75E89431FDB for ; Thu, 19 Dec 2013 11:12:42 -0800 + (PST) +Received: by mail-wg0-f41.google.com with SMTP id y10so6090285wgg.4 + for ; Thu, 19 Dec 2013 11:12:39 -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=nfag8NeuUcbDAG8pDNPTv5ONYFzW2Dx0P776BU9gO88=; + b=lhkQ+GGnEudcpy7d4S8t3QiBMN0KnNpR54TwsJFHquQR99slTAL63lfmn2n9ANZA32 + XJoZAb2l2YLbEexf7mc+pgZZ4x935ZSZXqr5RaAmRS6hmmcw/NO1xa7f2mk3a36QYa8G + rSwZfyLYmMWYaTXXgyHbmHIeHvy+RGoqlyFBeLR0tSmYZg/cytiE/GnCVkauMC+Tck39 + wyHDmMyrZIa5MonVDvQKJ8UwSPPBiFCqwU9PuFyfmgNz3C4wDxx82pYRNTPYQUaSsBzw + 5//XIxJ0ruh1qul1kc7atN9d85hz/qjB/PeXT0NYV51JQU8JYKWIzhdKjIugjG7gXq1a + 5E4Q== +X-Received: by 10.180.108.132 with SMTP id hk4mr4155876wib.12.1387480359781; + Thu, 19 Dec 2013 11:12:39 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id qj4sm719095wjc.15.2013.12.19.11.12.38 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Thu, 19 Dec 2013 11:12:39 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 2/2] emacs: tree: use tag-format-tags +Date: Thu, 19 Dec 2013 19:12:24 +0000 +Message-Id: <1387480344-14326-3-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1387480344-14326-1-git-send-email-markwalters1009@gmail.com> +References: <1387480344-14326-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: Thu, 19 Dec 2013 19:12:50 -0000 + +Previously tree did not use tag-format-tags: since tree wants to +distinguish matching messages from non-matching messages it is not a +perfect fit. + +However, in preparation for allowing tag-changes to be shown (i.e., +added or deleted tags to be indicated) it is convenient to make all +places displaying tags call the same routines. + +We modify notmuch-tag-format-tags slightly so that it can take and +argument for the default characteristics of the face before the +special tag features are applied. + +This also means that things like the star symbol for flagged messages +all work in tree. +--- + emacs/notmuch-tag.el | 17 +++++++++-------- + emacs/notmuch-tree.el | 8 ++++---- + 2 files changed, 13 insertions(+), 12 deletions(-) + +diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el +index b60f46c..908e7ad 100644 +--- a/emacs/notmuch-tag.el ++++ b/emacs/notmuch-tag.el +@@ -148,15 +148,16 @@ This can be used with `notmuch-tag-format-image-data'." + (dolist (format (cdr formats) tag) + (setq tag (eval format)))))))) + +-(defun notmuch-tag-format-tags (tags) ++(defun notmuch-tag-format-tags (tags &optional face) + "Return a string representing formatted TAGS." +- (notmuch-combine-face-text-property-string +- (mapconcat #'identity +- ;; nil indicated that the tag was deliberately hidden +- (delq nil (mapcar #'notmuch-tag-format-tag tags)) +- " ") +- 'notmuch-tag-face +- t)) ++ (let ((face (or face 'notmuch-tag-face))) ++ (notmuch-combine-face-text-property-string ++ (mapconcat #'identity ++ ;; nil indicated that the tag was deliberately hidden ++ (delq nil (mapcar #'notmuch-tag-format-tag tags)) ++ " ") ++ face ++ t))) + + (defcustom notmuch-before-tag-hook nil + "Hooks that are run before tags of a message are modified. +diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el +index 599f76e..ee20f1a 100644 +--- a/emacs/notmuch-tree.el ++++ b/emacs/notmuch-tree.el +@@ -690,10 +690,10 @@ unchanged ADDRESS if parsing fails." + (face (if match + 'notmuch-tree-match-tag-face + 'notmuch-tree-no-match-tag-face))) +- (propertize (format format-string +- (mapconcat #'identity tags " ")) +- 'face face)))))) +- ++ (notmuch-combine-face-text-property-string ++ (format format-string (notmuch-tag-format-tags tags face)) ++ face ++ t)))))) + + (defun notmuch-tree-format-field-list (field-list msg) + "Format fields of MSG according to FIELD-LIST and return string" +-- +1.7.9.1 +