unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [Patch v2 0/3] emacs: allow show to colour based on tags and flags
@ 2012-04-29 22:48 Mark Walters
  2012-04-29 22:48 ` [Patch v2 1/3] emacs: Move colour line from search to lib Mark Walters
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Mark Walters @ 2012-04-29 22:48 UTC (permalink / raw)
  To: notmuch

This is a rebased (but otherwise unchanged) version of
id:"1334431301-27303-1-git-send-email-markwalters1009@gmail.com".

It's probably too late for 0.13 but in case anyone would like to look
at it this version applies cleanly to master so should be easier to
test.

The first two patches are basically David Edmondson's patch
id:"1325006003-27152-1-git-send-email-dme@dme.org".

Best wishes

Mark


Mark Walters (3):
  emacs: Move colour line from search to lib
  emacs: Add `notmuch-show-line-faces' and apply it.
  emacs: allow notmuch-show-line-faces to use flags for colouring

 emacs/notmuch-lib.el  |   18 ++++++++++++++++++
 emacs/notmuch-show.el |   44 ++++++++++++++++++++++++++++++++++++++++----
 emacs/notmuch.el      |   15 +--------------
 3 files changed, 59 insertions(+), 18 deletions(-)

-- 
1.7.9.1

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

* [Patch v2 1/3] emacs: Move colour line from search to lib
  2012-04-29 22:48 [Patch v2 0/3] emacs: allow show to colour based on tags and flags Mark Walters
@ 2012-04-29 22:48 ` Mark Walters
  2012-04-29 22:48 ` [Patch v2 2/3] emacs: Add `notmuch-show-line-faces' and apply it Mark Walters
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Mark Walters @ 2012-04-29 22:48 UTC (permalink / raw)
  To: notmuch

This patch moves the overlay/colouring from notmuch.el to
notmuch-lib.el. This is in preparation for its use by notmuch-show in
the next patch. This is just a rebased version of the emacs/notmuch.el
and emacs/notmuch-lib.el parts of David Edmondson's patch (see
id:"1325006003-27152-1-git-send-email-dme@dme.org")
---
 emacs/notmuch-lib.el |   18 ++++++++++++++++++
 emacs/notmuch.el     |   15 +--------------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 6907a5f..c8a9351 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -148,6 +148,24 @@ the user hasn't set this variable with the old or new value."
   "Return a query that matches the message with id ID."
   (concat "id:\"" (replace-regexp-in-string "\"" "\"\"" id t t) "\""))
 
+(defun notmuch-color-line (start end line-tag-list spec)
+  "Colorize a line based on tags."
+  ;; Create the overlay only if the message has tags which match one
+  ;; of those specified in `spec'.
+  (let (overlay)
+    (mapc (lambda (elem)
+	    (let ((tag (car elem))
+		  (attributes (cdr elem)))
+	      (when (member tag line-tag-list)
+		(when (not overlay)
+		  (setq overlay (make-overlay start end))
+		  (overlay-put overlay 'priority 5))
+		;; Merge the specified properties with any already
+		;; applied from an earlier match.
+		(overlay-put overlay 'face
+			     (append (overlay-get overlay 'face) attributes)))))
+	  spec)))
+
 ;;
 
 (defun notmuch-common-do-stash (text)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index c6236db..d5f40e2 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -612,20 +612,7 @@ foreground and blue background."
 
 (defun notmuch-search-color-line (start end line-tag-list)
   "Colorize lines in `notmuch-show' based on tags."
-  ;; Create the overlay only if the message has tags which match one
-  ;; of those specified in `notmuch-search-line-faces'.
-  (let (overlay)
-    (mapc (lambda (elem)
-	    (let ((tag (car elem))
-		  (attributes (cdr elem)))
-	      (when (member tag line-tag-list)
-		(when (not overlay)
-		  (setq overlay (make-overlay start end)))
-		;; Merge the specified properties with any already
-		;; applied from an earlier match.
-		(overlay-put overlay 'face
-			     (append (overlay-get overlay 'face) attributes)))))
-	  notmuch-search-line-faces)))
+  (notmuch-color-line start end line-tag-list notmuch-search-line-faces))
 
 (defun notmuch-search-author-propertize (authors)
   "Split `authors' into matching and non-matching authors and
-- 
1.7.9.1

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

* [Patch v2 2/3] emacs: Add `notmuch-show-line-faces' and apply it.
  2012-04-29 22:48 [Patch v2 0/3] emacs: allow show to colour based on tags and flags Mark Walters
  2012-04-29 22:48 ` [Patch v2 1/3] emacs: Move colour line from search to lib Mark Walters
@ 2012-04-29 22:48 ` Mark Walters
  2012-05-05 11:45   ` Jani Nikula
  2012-04-29 22:48 ` [Patch v2 3/3] emacs: allow notmuch-show-line-faces to use flags for colouring Mark Walters
  2012-04-29 23:02 ` [Patch v2 0/3] emacs: allow show to colour based on tags and flags Austin Clements
  3 siblings, 1 reply; 12+ messages in thread
From: Mark Walters @ 2012-04-29 22:48 UTC (permalink / raw)
  To: notmuch

Similar to `notmuch-search-line-faces', `notmuch-show-line-faces'
allows the header line in `notmuch-show-mode' buffers to be coloured
according to the tags of the message. This is just a rebased version of
the  emacs/notmuch-show.el of David Edmondson's patch
id:"1325006003-27152-1-git-send-email-dme@dme.org"
---
 emacs/notmuch-show.el |   33 +++++++++++++++++++++++++++++----
 1 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 37f0ebb..bb7db6e 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -93,6 +93,24 @@ any given message."
   :group 'notmuch-show
   :group 'notmuch-hooks)
 
+(defcustom notmuch-show-line-faces nil
+  "Tag to face mapping for header line highlighting in `notmuch-show-mode'.
+
+Here is an example of how to color search results based on tags.
+ (the following text would be placed in your ~/.emacs file):
+
+ (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"
+						  :background \"blue\"))
+                                   (\"unread\" . (:foreground \"green\"))))
+
+The attributes defined for matching tags are merged, with later
+attributes overriding earlier. A message having both \"delete\"
+and \"unread\" tags with the above settings would have a green
+foreground and blue background."
+  :type '(alist :key-type (string) :value-type (custom-face-edit))
+  :group 'notmuch-show
+  :group 'notmuch-faces)
+
 ;; Mostly useful for debugging.
 (defcustom notmuch-show-all-multipart/alternative-parts t
   "Should all parts of multipart/alternative parts be shown?"
@@ -411,7 +429,8 @@ unchanged ADDRESS if parsing fails."
 (defun notmuch-show-insert-headerline (headers date tags depth)
   "Insert a notmuch style headerline based on HEADERS for a
 message at DEPTH in the current thread."
-  (let ((start (point)))
+  (let ((start (point))
+	overlay)
     (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
 	    (notmuch-show-clean-address (plist-get headers :From))
 	    " ("
@@ -420,7 +439,9 @@ message at DEPTH in the current thread."
 	    (propertize (mapconcat 'identity tags " ")
 			'face 'notmuch-tag-face)
 	    ")\n")
-    (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face)))
+    (setq overlay (make-overlay start (point)))
+    (overlay-put overlay 'face 'notmuch-message-summary-face)
+    (overlay-put overlay 'priority 2)))
 
 (defun notmuch-show-insert-header (header header-value)
   "Insert a single header."
@@ -852,7 +873,8 @@ current buffer, if possible."
 	 body-start body-end
 	 (headers-invis-spec (notmuch-show-make-symbol "header"))
 	 (message-invis-spec (notmuch-show-make-symbol "message"))
-	 (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))))
+	 (bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))
+	 (tags (plist-get msg :tags)))
 
     ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise
     ;; removing items from `buffer-invisibility-spec' (which is what
@@ -877,10 +899,13 @@ current buffer, if possible."
 					    (plist-get msg :date_relative)
 					  nil)
 					(plist-get headers :Date))
-				    (plist-get msg :tags) depth)
+				    tags depth)
 
     (setq content-start (point-marker))
 
+    ;; Colour the header line according to the tags of the message.
+    (notmuch-color-line message-start content-start tags notmuch-show-line-faces)
+
     (plist-put msg :headers-invis-spec headers-invis-spec)
     (plist-put msg :message-invis-spec message-invis-spec)
 
-- 
1.7.9.1

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

* [Patch v2 3/3] emacs: allow notmuch-show-line-faces to use flags for colouring
  2012-04-29 22:48 [Patch v2 0/3] emacs: allow show to colour based on tags and flags Mark Walters
  2012-04-29 22:48 ` [Patch v2 1/3] emacs: Move colour line from search to lib Mark Walters
  2012-04-29 22:48 ` [Patch v2 2/3] emacs: Add `notmuch-show-line-faces' and apply it Mark Walters
@ 2012-04-29 22:48 ` Mark Walters
  2012-04-30  4:49   ` Tomi Ollila
  2012-04-29 23:02 ` [Patch v2 0/3] emacs: allow show to colour based on tags and flags Austin Clements
  3 siblings, 1 reply; 12+ messages in thread
From: Mark Walters @ 2012-04-29 22:48 UTC (permalink / raw)
  To: notmuch

This allows header-lines `notmuch-show-mode' buffers to be coloured
based on the flags (match/excluded) of the message. It supplies the
line colouring function with a list of tags each prefixed with "tag:"
and a list of flags ("match" or "excluded") each prefixed with
"flag:".

The match flag is obviously not equivalent to a tag; the excluded flag
looks equivalent but is subtly different: a message is not marked
excluded if that tag appeared in the query.
---
 emacs/notmuch-show.el |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index bb7db6e..f09de26 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -96,14 +96,16 @@ any given message."
 (defcustom notmuch-show-line-faces nil
   "Tag to face mapping for header line highlighting in `notmuch-show-mode'.
 
-Here is an example of how to color search results based on tags.
+Here is an example of how to color search results based on tags
+and flags (match and excluded).
  (the following text would be placed in your ~/.emacs file):
 
- (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"
+ (setq notmuch-search-line-faces '((\"tag:delete\" . (:foreground \"red\"
 						  :background \"blue\"))
-                                   (\"unread\" . (:foreground \"green\"))))
+                                   (\"tag:unread\" . (:foreground \"green\"))
+                                   (\"flag:excluded\" . (:background \"grey\"))))
 
-The attributes defined for matching tags are merged, with later
+The attributes defined for matching tags/flags are merged, with later
 attributes overriding earlier. A message having both \"delete\"
 and \"unread\" tags with the above settings would have a green
 foreground and blue background."
@@ -871,11 +873,20 @@ current buffer, if possible."
 	 content-start content-end
 	 headers-start headers-end
 	 body-start body-end
+	 tags-and-flags
 	 (headers-invis-spec (notmuch-show-make-symbol "header"))
 	 (message-invis-spec (notmuch-show-make-symbol "message"))
 	 (bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))
 	 (tags (plist-get msg :tags)))
 
+    (mapc (lambda (tag)
+	    (setq tags-and-flags (cons (concat "tag:" tag) tags-and-flags)))
+	  tags)
+    (if (plist-get msg :match)
+	(setq tags-and-flags (cons "flag:match" tags-and-flags)))
+    (if (plist-get msg :excluded)
+	(setq tags-and-flags (cons "flag:excluded" tags-and-flags)))
+
     ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise
     ;; removing items from `buffer-invisibility-spec' (which is what
     ;; `notmuch-show-headers-visible' and
@@ -904,7 +915,7 @@ current buffer, if possible."
     (setq content-start (point-marker))
 
     ;; Colour the header line according to the tags of the message.
-    (notmuch-color-line message-start content-start tags notmuch-show-line-faces)
+    (notmuch-color-line message-start content-start tags-and-flags notmuch-show-line-faces)
 
     (plist-put msg :headers-invis-spec headers-invis-spec)
     (plist-put msg :message-invis-spec message-invis-spec)
-- 
1.7.9.1

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

* Re: [Patch v2 0/3] emacs: allow show to colour based on tags and flags
  2012-04-29 22:48 [Patch v2 0/3] emacs: allow show to colour based on tags and flags Mark Walters
                   ` (2 preceding siblings ...)
  2012-04-29 22:48 ` [Patch v2 3/3] emacs: allow notmuch-show-line-faces to use flags for colouring Mark Walters
@ 2012-04-29 23:02 ` Austin Clements
  2012-04-29 23:37   ` Mark Walters
  2012-05-02  0:30   ` Jameson Graef Rollins
  3 siblings, 2 replies; 12+ messages in thread
From: Austin Clements @ 2012-04-29 23:02 UTC (permalink / raw)
  To: Mark Walters; +Cc: notmuch

I haven't really looked at this series yet, but I do have a quick
high-level question.  Why use separate customization variables for the
colors in search and show mode?  Wouldn't it make more sense to set
the colors just once and use them in both modes?

BTW, I like how this clearly distinguishes tags and flags.  I wonder
if we could transition to flags for some information that's current
shoe-horned into tags but actually represents immutable information
about a message (attachment, signed, and encrypted or so).

My one concern is that there's a common tag called "flagged", so this
might be overloading terminology.

Quoth Mark Walters on Apr 29 at 11:48 pm:
> This is a rebased (but otherwise unchanged) version of
> id:"1334431301-27303-1-git-send-email-markwalters1009@gmail.com".
> 
> It's probably too late for 0.13 but in case anyone would like to look
> at it this version applies cleanly to master so should be easier to
> test.
> 
> The first two patches are basically David Edmondson's patch
> id:"1325006003-27152-1-git-send-email-dme@dme.org".
> 
> Best wishes
> 
> Mark
> 
> 
> Mark Walters (3):
>   emacs: Move colour line from search to lib
>   emacs: Add `notmuch-show-line-faces' and apply it.
>   emacs: allow notmuch-show-line-faces to use flags for colouring
> 
>  emacs/notmuch-lib.el  |   18 ++++++++++++++++++
>  emacs/notmuch-show.el |   44 ++++++++++++++++++++++++++++++++++++++++----
>  emacs/notmuch.el      |   15 +--------------
>  3 files changed, 59 insertions(+), 18 deletions(-)

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

* Re: [Patch v2 0/3] emacs: allow show to colour based on tags and flags
  2012-04-29 23:02 ` [Patch v2 0/3] emacs: allow show to colour based on tags and flags Austin Clements
@ 2012-04-29 23:37   ` Mark Walters
  2012-05-02  0:30   ` Jameson Graef Rollins
  1 sibling, 0 replies; 12+ messages in thread
From: Mark Walters @ 2012-04-29 23:37 UTC (permalink / raw)
  To: Austin Clements, notmuch


On Mon, 30 Apr 2012, Austin Clements <amdragon@MIT.EDU> wrote:
> I haven't really looked at this series yet, but I do have a quick
> high-level question.  Why use separate customization variables for the
> colors in search and show mode?  Wouldn't it make more sense to set
> the colors just once and use them in both modes?

I think that their use is somewhat different since in show mode the
colour can be quite high contrast because mostly you only have a few
header lines (that may depend how much time you spend in
expanded/collapsed views); one example is that in show mode the header
line normally has a background colour (I think even without
customisation) whereas in search mode that would be weird as every line
would have it.

> BTW, I like how this clearly distinguishes tags and flags.  I wonder
> if we could transition to flags for some information that's current
> shoe-horned into tags but actually represents immutable information
> about a message (attachment, signed, and encrypted or so).

Yes some of those could make sense: I hadn't thought about them at
all. I think attachment is closer to a genuine tag as I frequently include
tag:attachment in my searched but I would guess that searching for
signed/encrypted is not as common (but I don't use either so could be wrong)

> My one concern is that there's a common tag called "flagged", so this
> might be overloading terminology.

I hadn't thought of that: I agree but don't have a good suggestion for
avoiding it. 

Best wishes

Mark


>
> Quoth Mark Walters on Apr 29 at 11:48 pm:
>> This is a rebased (but otherwise unchanged) version of
>> id:"1334431301-27303-1-git-send-email-markwalters1009@gmail.com".
>> 
>> It's probably too late for 0.13 but in case anyone would like to look
>> at it this version applies cleanly to master so should be easier to
>> test.
>> 
>> The first two patches are basically David Edmondson's patch
>> id:"1325006003-27152-1-git-send-email-dme@dme.org".
>> 
>> Best wishes
>> 
>> Mark
>> 
>> 
>> Mark Walters (3):
>>   emacs: Move colour line from search to lib
>>   emacs: Add `notmuch-show-line-faces' and apply it.
>>   emacs: allow notmuch-show-line-faces to use flags for colouring
>> 
>>  emacs/notmuch-lib.el  |   18 ++++++++++++++++++
>>  emacs/notmuch-show.el |   44 ++++++++++++++++++++++++++++++++++++++++----
>>  emacs/notmuch.el      |   15 +--------------
>>  3 files changed, 59 insertions(+), 18 deletions(-)

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

* Re: [Patch v2 3/3] emacs: allow notmuch-show-line-faces to use flags for colouring
  2012-04-29 22:48 ` [Patch v2 3/3] emacs: allow notmuch-show-line-faces to use flags for colouring Mark Walters
@ 2012-04-30  4:49   ` Tomi Ollila
  0 siblings, 0 replies; 12+ messages in thread
From: Tomi Ollila @ 2012-04-30  4:49 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Mon, Apr 30 2012, Mark Walters <markwalters1009@gmail.com> wrote:

[ ... ]
> ---
>  emacs/notmuch-show.el |   21 ++++++++++++++++-----
>  1 files changed, 16 insertions(+), 5 deletions(-)

[ ... ]

> - (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"
> + (setq notmuch-search-line-faces '((\"tag:delete\" . (:foreground \"red\"
>  						  :background \"blue\"))
> -                                   (\"unread\" . (:foreground \"green\"))))
> +                                   (\"tag:unread\" . (:foreground \"green\"))
> +                                   (\"flag:excluded\" . (:background \"grey\"))))

Quick note -- "delete" is to be changed to "deleted" (in examples, too :)


Tomi

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

* Re: [Patch v2 0/3] emacs: allow show to colour based on tags and flags
  2012-04-29 23:02 ` [Patch v2 0/3] emacs: allow show to colour based on tags and flags Austin Clements
  2012-04-29 23:37   ` Mark Walters
@ 2012-05-02  0:30   ` Jameson Graef Rollins
  2012-05-04  5:46     ` Mark Walters
  1 sibling, 1 reply; 12+ messages in thread
From: Jameson Graef Rollins @ 2012-05-02  0:30 UTC (permalink / raw)
  To: Austin Clements, Mark Walters; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 1035 bytes --]

On Sun, Apr 29 2012, Austin Clements <amdragon@MIT.EDU> wrote:
> I haven't really looked at this series yet, but I do have a quick
> high-level question.  Why use separate customization variables for the
> colors in search and show mode?  Wouldn't it make more sense to set
> the colors just once and use them in both modes?

I thought about this myself as soon as I read the patch.  I think I
would always want the colors to match, so it would make sense to me to
set them in one place.

> BTW, I like how this clearly distinguishes tags and flags.  I wonder
> if we could transition to flags for some information that's current
> shoe-horned into tags but actually represents immutable information
> about a message (attachment, signed, and encrypted or so).

Yes!  As Austin probably remembers, we've discussed this before.  I
definitely agree that it makes sense to somehow distinguish "immutable"
information that is a fundamental, unchanging/able property of the
message, and it might be nice to look ahead to that here.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [Patch v2 0/3] emacs: allow show to colour based on tags and flags
  2012-05-02  0:30   ` Jameson Graef Rollins
@ 2012-05-04  5:46     ` Mark Walters
  2012-05-04 14:22       ` Jameson Graef Rollins
  2012-05-05 11:57       ` Jani Nikula
  0 siblings, 2 replies; 12+ messages in thread
From: Mark Walters @ 2012-05-04  5:46 UTC (permalink / raw)
  To: Jameson Graef Rollins, Austin Clements; +Cc: notmuch


On Wed, 02 May 2012, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
> On Sun, Apr 29 2012, Austin Clements <amdragon@MIT.EDU> wrote:
>> I haven't really looked at this series yet, but I do have a quick
>> high-level question.  Why use separate customization variables for the
>> colors in search and show mode?  Wouldn't it make more sense to set
>> the colors just once and use them in both modes?
>
> I thought about this myself as soon as I read the patch.  I think I
> would always want the colors to match, so it would make sense to me to
> set them in one place.

Hi

I think both are useful (see my reply to Austin) but having show apply
the faces from notmuch-search first seems a good idea.

There are a couple of extra reasons why I like the show ones
separate. One is that I like to colour headerlines of matching messages to
highlight them, but in search mode that would highlight every
line. Secondly, I colour some things "negatively" in show mode: for
example I show excluded messages in grey. This negative colouring does
not make sense for search mode because I would only want to grey out
results where all messages were excluded not results where at least one
message is excluded. Of course we don't show entirely excluded threads
in search, but similar comments apply to say the "replied" tag: I could
show those in green (on the basis they are "dealt with") but I would not
want a thread coloured green just because I have replied to one message
in it.

>
>> BTW, I like how this clearly distinguishes tags and flags.  I wonder
>> if we could transition to flags for some information that's current
>> shoe-horned into tags but actually represents immutable information
>> about a message (attachment, signed, and encrypted or so).
>
> Yes!  As Austin probably remembers, we've discussed this before.  I
> definitely agree that it makes sense to somehow distinguish "immutable"
> information that is a fundamental, unchanging/able property of the
> message, and it might be nice to look ahead to that here.

In essence I agree: my only concern is can the user search for these
immutable things, and what syntax is used there. 

Best wishes

Mark

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

* Re: [Patch v2 0/3] emacs: allow show to colour based on tags and flags
  2012-05-04  5:46     ` Mark Walters
@ 2012-05-04 14:22       ` Jameson Graef Rollins
  2012-05-05 11:57       ` Jani Nikula
  1 sibling, 0 replies; 12+ messages in thread
From: Jameson Graef Rollins @ 2012-05-04 14:22 UTC (permalink / raw)
  To: Mark Walters, Austin Clements; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 2091 bytes --]

On Thu, May 03 2012, Mark Walters <markwalters1009@gmail.com> wrote:
> There are a couple of extra reasons why I like the show ones
> separate. One is that I like to colour headerlines of matching messages to
> highlight them, but in search mode that would highlight every
> line. Secondly, I colour some things "negatively" in show mode: for
> example I show excluded messages in grey. This negative colouring does
> not make sense for search mode because I would only want to grey out
> results where all messages were excluded not results where at least one
> message is excluded. Of course we don't show entirely excluded threads
> in search, but similar comments apply to say the "replied" tag: I could
> show those in green (on the basis they are "dealt with") but I would not
> want a thread coloured green just because I have replied to one message
> in it.

Ok, that makes sense.  Maybe there could be switch to inherit colors,
and then a way to set them independently as well.

>>> BTW, I like how this clearly distinguishes tags and flags.  I wonder
>>> if we could transition to flags for some information that's current
>>> shoe-horned into tags but actually represents immutable information
>>> about a message (attachment, signed, and encrypted or so).
>>
>> Yes!  As Austin probably remembers, we've discussed this before.  I
>> definitely agree that it makes sense to somehow distinguish "immutable"
>> information that is a fundamental, unchanging/able property of the
>> message, and it might be nice to look ahead to that here.
>
> In essence I agree: my only concern is can the user search for these
> immutable things, and what syntax is used there. 

Well, nothing exists yet so we can define it as we wish, but I would say
absolutely they should be searchable.  That's an important part.  They
just wouldn't be changable, like tags are, since they represent
immutable characteristics of the original message.  I would suggest we
use something like "prop:" (for "property"), e.g. "prop:signed", or
"prop:attachment", etc.

jamie.

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

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

* Re: [Patch v2 2/3] emacs: Add `notmuch-show-line-faces' and apply it.
  2012-04-29 22:48 ` [Patch v2 2/3] emacs: Add `notmuch-show-line-faces' and apply it Mark Walters
@ 2012-05-05 11:45   ` Jani Nikula
  0 siblings, 0 replies; 12+ messages in thread
From: Jani Nikula @ 2012-05-05 11:45 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Mon, 30 Apr 2012, Mark Walters <markwalters1009@gmail.com> wrote:
> Similar to `notmuch-search-line-faces', `notmuch-show-line-faces'
> allows the header line in `notmuch-show-mode' buffers to be coloured
> according to the tags of the message. This is just a rebased version of
> the  emacs/notmuch-show.el of David Edmondson's patch
> id:"1325006003-27152-1-git-send-email-dme@dme.org"
> ---
>  emacs/notmuch-show.el |   33 +++++++++++++++++++++++++++++----
>  1 files changed, 29 insertions(+), 4 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 37f0ebb..bb7db6e 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -93,6 +93,24 @@ any given message."
>    :group 'notmuch-show
>    :group 'notmuch-hooks)
>  
> +(defcustom notmuch-show-line-faces nil
> +  "Tag to face mapping for header line highlighting in `notmuch-show-mode'.
> +
> +Here is an example of how to color search results based on tags.
> + (the following text would be placed in your ~/.emacs file):
> +
> + (setq notmuch-search-line-faces '((\"delete\" . (:foreground \"red\"

That should be notmuch-show-line-faces.

Jani.

> +						  :background \"blue\"))
> +                                   (\"unread\" . (:foreground \"green\"))))
> +
> +The attributes defined for matching tags are merged, with later
> +attributes overriding earlier. A message having both \"delete\"
> +and \"unread\" tags with the above settings would have a green
> +foreground and blue background."
> +  :type '(alist :key-type (string) :value-type (custom-face-edit))
> +  :group 'notmuch-show
> +  :group 'notmuch-faces)
> +
>  ;; Mostly useful for debugging.
>  (defcustom notmuch-show-all-multipart/alternative-parts t
>    "Should all parts of multipart/alternative parts be shown?"
> @@ -411,7 +429,8 @@ unchanged ADDRESS if parsing fails."
>  (defun notmuch-show-insert-headerline (headers date tags depth)
>    "Insert a notmuch style headerline based on HEADERS for a
>  message at DEPTH in the current thread."
> -  (let ((start (point)))
> +  (let ((start (point))
> +	overlay)
>      (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth))
>  	    (notmuch-show-clean-address (plist-get headers :From))
>  	    " ("
> @@ -420,7 +439,9 @@ message at DEPTH in the current thread."
>  	    (propertize (mapconcat 'identity tags " ")
>  			'face 'notmuch-tag-face)
>  	    ")\n")
> -    (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face)))
> +    (setq overlay (make-overlay start (point)))
> +    (overlay-put overlay 'face 'notmuch-message-summary-face)
> +    (overlay-put overlay 'priority 2)))
>  
>  (defun notmuch-show-insert-header (header header-value)
>    "Insert a single header."
> @@ -852,7 +873,8 @@ current buffer, if possible."
>  	 body-start body-end
>  	 (headers-invis-spec (notmuch-show-make-symbol "header"))
>  	 (message-invis-spec (notmuch-show-make-symbol "message"))
> -	 (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))))
> +	 (bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))
> +	 (tags (plist-get msg :tags)))
>  
>      ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise
>      ;; removing items from `buffer-invisibility-spec' (which is what
> @@ -877,10 +899,13 @@ current buffer, if possible."
>  					    (plist-get msg :date_relative)
>  					  nil)
>  					(plist-get headers :Date))
> -				    (plist-get msg :tags) depth)
> +				    tags depth)
>  
>      (setq content-start (point-marker))
>  
> +    ;; Colour the header line according to the tags of the message.
> +    (notmuch-color-line message-start content-start tags notmuch-show-line-faces)
> +
>      (plist-put msg :headers-invis-spec headers-invis-spec)
>      (plist-put msg :message-invis-spec message-invis-spec)
>  
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [Patch v2 0/3] emacs: allow show to colour based on tags and flags
  2012-05-04  5:46     ` Mark Walters
  2012-05-04 14:22       ` Jameson Graef Rollins
@ 2012-05-05 11:57       ` Jani Nikula
  1 sibling, 0 replies; 12+ messages in thread
From: Jani Nikula @ 2012-05-05 11:57 UTC (permalink / raw)
  To: Mark Walters, Jameson Graef Rollins, Austin Clements; +Cc: notmuch

On Fri, 04 May 2012, Mark Walters <markwalters1009@gmail.com> wrote:
> On Wed, 02 May 2012, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
>> On Sun, Apr 29 2012, Austin Clements <amdragon@MIT.EDU> wrote:
>>> I haven't really looked at this series yet, but I do have a quick
>>> high-level question.  Why use separate customization variables for the
>>> colors in search and show mode?  Wouldn't it make more sense to set
>>> the colors just once and use them in both modes?
>>
>> I thought about this myself as soon as I read the patch.  I think I
>> would always want the colors to match, so it would make sense to me to
>> set them in one place.
>
> Hi
>
> I think both are useful (see my reply to Austin) but having show apply
> the faces from notmuch-search first seems a good idea.
>
> There are a couple of extra reasons why I like the show ones
> separate. One is that I like to colour headerlines of matching messages to
> highlight them, but in search mode that would highlight every
> line. Secondly, I colour some things "negatively" in show mode: for
> example I show excluded messages in grey. This negative colouring does
> not make sense for search mode because I would only want to grey out
> results where all messages were excluded not results where at least one
> message is excluded. Of course we don't show entirely excluded threads
> in search, but similar comments apply to say the "replied" tag: I could
> show those in green (on the basis they are "dealt with") but I would not
> want a thread coloured green just because I have replied to one message
> in it.

I completely agree with having separate faces for search and show.

>>> BTW, I like how this clearly distinguishes tags and flags.  I wonder
>>> if we could transition to flags for some information that's current
>>> shoe-horned into tags but actually represents immutable information
>>> about a message (attachment, signed, and encrypted or so).
>>
>> Yes!  As Austin probably remembers, we've discussed this before.  I
>> definitely agree that it makes sense to somehow distinguish "immutable"
>> information that is a fundamental, unchanging/able property of the
>> message, and it might be nice to look ahead to that here.
>
> In essence I agree: my only concern is can the user search for these
> immutable things, and what syntax is used there. 

Making a separation between immutable properties (like "attachment" or
"signed") and tags is a good goal, but AFAICS doing that right requires
changes all the way down to the library. I wouldn't worry about it at
all here. From emacs UI perspective they're all just tags. This is here
now, and works; there's no need to complicate matters when there's
nobody doing anything about the plumbing. Fixing this later is a trivial
matter compared to the plumbing work in cli and lib.


BR,
Jani.



>
> Best wishes
>
> Mark
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

end of thread, other threads:[~2012-05-05 11:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-29 22:48 [Patch v2 0/3] emacs: allow show to colour based on tags and flags Mark Walters
2012-04-29 22:48 ` [Patch v2 1/3] emacs: Move colour line from search to lib Mark Walters
2012-04-29 22:48 ` [Patch v2 2/3] emacs: Add `notmuch-show-line-faces' and apply it Mark Walters
2012-05-05 11:45   ` Jani Nikula
2012-04-29 22:48 ` [Patch v2 3/3] emacs: allow notmuch-show-line-faces to use flags for colouring Mark Walters
2012-04-30  4:49   ` Tomi Ollila
2012-04-29 23:02 ` [Patch v2 0/3] emacs: allow show to colour based on tags and flags Austin Clements
2012-04-29 23:37   ` Mark Walters
2012-05-02  0:30   ` Jameson Graef Rollins
2012-05-04  5:46     ` Mark Walters
2012-05-04 14:22       ` Jameson Graef Rollins
2012-05-05 11:57       ` Jani Nikula

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