From 8df4d3c80a750f2f88cf3b4fbe65910cec785e0e Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 11 Jan 2014 21:49:52 +0000 Subject: [PATCH] [PATCH 2/2] emacs: tree: use tag-format-tags --- b1/3904bbb240b88c331c519bc3c36f889e9b3e0e | 134 ++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 b1/3904bbb240b88c331c519bc3c36f889e9b3e0e diff --git a/b1/3904bbb240b88c331c519bc3c36f889e9b3e0e b/b1/3904bbb240b88c331c519bc3c36f889e9b3e0e new file mode 100644 index 000000000..3c35cd822 --- /dev/null +++ b/b1/3904bbb240b88c331c519bc3c36f889e9b3e0e @@ -0,0 +1,134 @@ +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 2A993431FD0 + for ; Sat, 11 Jan 2014 13:50:08 -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 4DtpIr0WpfrT for ; + Sat, 11 Jan 2014 13:50:00 -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 + D6A49431FC3 for ; Sat, 11 Jan 2014 13:49:59 -0800 + (PST) +Received: by mail-wg0-f41.google.com with SMTP id n12so1574647wgh.2 + for ; Sat, 11 Jan 2014 13:49:58 -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=yJLceqTnkLriCky8jgkCvgC010TmwuEQ5Vpy4mbYVBw=; + b=h8QfxcNMTM+6xMYIV/GSOUtS6R+Z2dJbfhhwP6V6zXj7X4sAGa3ou9AReyvlyxiWpp + 8EYFVAFCIvSCTMcbqmYxkiZSJDvvjLX+KQj/io2Jy8zQw+RpdqQJhlyGZx9q0dlAM4a2 + p8DVkXeyZKma6O9tHrZI2jcC69RWw5VtlYiAoxNYC8gvCNngzqH/y+fCQ4ncojlEF0nx + sJJiQmH9sCe5LNUJAmHxQVFjZ22I0UtCt9U2DFCcEoBe9UBgeQiDD0NRRopbf0sRO9Gh + FbhIlT73waMi5VegBkvRPWB1Nh3QynT1Bvb5Mhj8/i4FHXcqXy4oPpEFVFmSgCZYxL2K + fqag== +X-Received: by 10.194.219.1 with SMTP id pk1mr14912062wjc.36.1389476998637; + Sat, 11 Jan 2014 13:49:58 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id x4sm9562587wif.0.2014.01.11.13.49.57 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 11 Jan 2014 13:49:58 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 2/2] emacs: tree: use tag-format-tags +Date: Sat, 11 Jan 2014 21:49:52 +0000 +Message-Id: <1389476992-24122-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1389476503-23682-2-git-send-email-markwalters1009@gmail.com> +References: <1389476503-23682-2-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:50:08 -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. + +--- + +(Sorry if this arrives multiple times: I am having problems sending mail) + + emacs/notmuch-tag.el | 17 +++++++++-------- + emacs/notmuch-tree.el | 5 +---- + 2 files changed, 10 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 16f2862..4f2ac02 100644 +--- a/emacs/notmuch-tree.el ++++ b/emacs/notmuch-tree.el +@@ -704,10 +704,7 @@ 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)))))) +- ++ (format format-string (notmuch-tag-format-tags tags face))))))) + + (defun notmuch-tree-format-field-list (field-list msg) + "Format fields of MSG according to FIELD-LIST and return string" +-- +1.7.9.1 + -- 2.26.2