unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 0/2] emacs: tree: use notmuch-tag-format-tags
@ 2014-01-11 21:41 Mark Walters
  2014-01-11 21:41 ` [PATCH 1/2] emacs: tree: default face for matching/non-matching messages Mark Walters
  2014-01-13 21:00 ` [PATCH 0/2] emacs: tree: use notmuch-tag-format-tags Tomi Ollila
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Walters @ 2014-01-11 21:41 UTC (permalink / raw)
  To: notmuch

This is a reworking of the second patch in the series
id:1387480344-14326-1-git-send-email-markwalters1009@gmail.com (it
applies on top of the first patch in that series which has been marked
ready)

The first patch gives tree default matching/non-matching faces. This
should make it easier for users to customize the tree display. It also
makes the switch to using notmuch-tag-format-tags easier in patch 2 of
this series.

Best wishes

Mark






Mark Walters (2):
  emacs: tree: default face for matching/non-matching messages
  emacs: tree: use tag-format-tags

 emacs/notmuch-tag.el  |   17 +++++++++--------
 emacs/notmuch-tree.el |   41 +++++++++++++++++++++++++++--------------
 2 files changed, 36 insertions(+), 22 deletions(-)

-- 
1.7.9.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] emacs: tree: default face for matching/non-matching messages
  2014-01-11 21:41 [PATCH 0/2] emacs: tree: use notmuch-tag-format-tags Mark Walters
@ 2014-01-11 21:41 ` Mark Walters
  2014-01-11 21:49   ` [PATCH 2/2] emacs: tree: use tag-format-tags Mark Walters
  2014-01-19  0:06   ` [PATCH 1/2] emacs: tree: default face for matching/non-matching messages David Bremner
  2014-01-13 21:00 ` [PATCH 0/2] emacs: tree: use notmuch-tag-format-tags Tomi Ollila
  1 sibling, 2 replies; 5+ messages in thread
From: Mark Walters @ 2014-01-11 21:41 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] emacs: tree: use tag-format-tags
  2014-01-11 21:41 ` [PATCH 1/2] emacs: tree: default face for matching/non-matching messages Mark Walters
@ 2014-01-11 21:49   ` Mark Walters
  2014-01-19  0:06   ` [PATCH 1/2] emacs: tree: default face for matching/non-matching messages David Bremner
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Walters @ 2014-01-11 21:49 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] emacs: tree: use notmuch-tag-format-tags
  2014-01-11 21:41 [PATCH 0/2] emacs: tree: use notmuch-tag-format-tags Mark Walters
  2014-01-11 21:41 ` [PATCH 1/2] emacs: tree: default face for matching/non-matching messages Mark Walters
@ 2014-01-13 21:00 ` Tomi Ollila
  1 sibling, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2014-01-13 21:00 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Jan 11 2014, Mark Walters <markwalters1009@gmail.com> wrote:

> This is a reworking of the second patch in the series
> id:1387480344-14326-1-git-send-email-markwalters1009@gmail.com (it
> applies on top of the first patch in that series which has been marked
> ready)
>
> The first patch gives tree default matching/non-matching faces. This
> should make it easier for users to customize the tree display. It also
> makes the switch to using notmuch-tag-format-tags easier in patch 2 of
> this series.

These patches look good to me and works nicely -- I wish search buffer
had the same tag coloring...

>
> Best wishes
>
> Mark

Tomi


>
>
>
>
>
>
> Mark Walters (2):
>   emacs: tree: default face for matching/non-matching messages
>   emacs: tree: use tag-format-tags
>
>  emacs/notmuch-tag.el  |   17 +++++++++--------
>  emacs/notmuch-tree.el |   41 +++++++++++++++++++++++++++--------------
>  2 files changed, 36 insertions(+), 22 deletions(-)
>
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] emacs: tree: default face for matching/non-matching messages
  2014-01-11 21:41 ` [PATCH 1/2] emacs: tree: default face for matching/non-matching messages Mark Walters
  2014-01-11 21:49   ` [PATCH 2/2] emacs: tree: use tag-format-tags Mark Walters
@ 2014-01-19  0:06   ` David Bremner
  1 sibling, 0 replies; 5+ messages in thread
From: David Bremner @ 2014-01-19  0:06 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> 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.

pushed both,

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-01-19  0:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-11 21:41 [PATCH 0/2] emacs: tree: use notmuch-tag-format-tags Mark Walters
2014-01-11 21:41 ` [PATCH 1/2] emacs: tree: default face for matching/non-matching messages Mark Walters
2014-01-11 21:49   ` [PATCH 2/2] emacs: tree: use tag-format-tags Mark Walters
2014-01-19  0:06   ` [PATCH 1/2] emacs: tree: default face for matching/non-matching messages David Bremner
2014-01-13 21:00 ` [PATCH 0/2] emacs: tree: use notmuch-tag-format-tags Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).