[PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread Michal Sojka
On Fri, 05 Nov 2010, Michal Sojka wrote:
> On Thu, 04 Nov 2010, David Edmondson wrote:
> > On Thu, 04 Nov 2010 15:12:53 +0100, Michal Sojka  
> > wrote:
> > > > Michal, was this addressed by the patch that Carl recently merged?
> > > > (Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
> > > > repository.)
> > > 
> > > Unfortunately not. In your patch, the overlay changes the color/face of 
> > > the
> > > whole line while my patch change the color/face of all parts of the line
> > > except for non-matching authors. With my patch non-matched autors were
> > 
> > I understand now.
> 
> > 
> > This seems somewhat like a policy decision, though. If I indicate that I
> > want the foreground text for a particular line to be red, should the
> > formatting of non-matching authors override that?
> > 
> > (My own approach has been to have `notmuch-search-line-faces' always
> > specify a background colour whereas
> > `notmuch-search-non-matching-authors' (or any of the columnar faces)
> > specify a foreground colour and/or slant.)
> 
> And now I even understand your patch. That's exactly what I wanted.
> Nice. I thought that overlays change completely the face of the line,
> hiding any faces "under" the overlay. Now I see, that
> notmuch-search-line-faces faces are combined with what was there
> before.

However, it seems that chaning :background in notmuch-search-line-faces
collides somewhat with hl-line-mode. If I move the point down to the
line with changed background, the line is not highlited. Only if I move
the point upwards, I see the line in green.

-Michal


[PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread Michal Sojka
On Thu, 04 Nov 2010, David Edmondson wrote:
> On Thu, 04 Nov 2010 15:12:53 +0100, Michal Sojka  
> wrote:
> > > Michal, was this addressed by the patch that Carl recently merged?
> > > (Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
> > > repository.)
> > 
> > Unfortunately not. In your patch, the overlay changes the color/face of the
> > whole line while my patch change the color/face of all parts of the line
> > except for non-matching authors. With my patch non-matched autors were
> 
> I understand now.

> 
> This seems somewhat like a policy decision, though. If I indicate that I
> want the foreground text for a particular line to be red, should the
> formatting of non-matching authors override that?
> 
> (My own approach has been to have `notmuch-search-line-faces' always
> specify a background colour whereas
> `notmuch-search-non-matching-authors' (or any of the columnar faces)
> specify a foreground colour and/or slant.)

And now I even understand your patch. That's exactly what I wanted.
Nice. I thought that overlays change completely the face of the line,
hiding any faces "under" the overlay. Now I see, that
notmuch-search-line-faces faces are combined with what was there before.

-Michal



[PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread David Edmondson
On Fri, 05 Nov 2010 09:17:00 +0100, Michal Sojka  wrote:
> However, it seems that chaning :background in notmuch-search-line-faces
> collides somewhat with hl-line-mode. If I move the point down to the
> line with changed background, the line is not highlited. Only if I move
> the point upwards, I see the line in green.

My `highlight' face uses only underlining :-)

If another way of merging the faces improves things, please do post
another patch.


[PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread Jameson Rollins
On Fri, 05 Nov 2010 09:17:00 +0100, Michal Sojka  wrote:
> However, it seems that chaning :background in notmuch-search-line-faces
> collides somewhat with hl-line-mode. If I move the point down to the
> line with changed background, the line is not highlited. Only if I move
> the point upwards, I see the line in green.

Hey, Michal.  I and some others have noticed this as well.  Not sure
what's going on, though.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



Re: [PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread Michal Sojka
On Fri, 05 Nov 2010, Michal Sojka wrote:
 On Thu, 04 Nov 2010, David Edmondson wrote:
  On Thu, 04 Nov 2010 15:12:53 +0100, Michal Sojka sojk...@fel.cvut.cz 
  wrote:
Michal, was this addressed by the patch that Carl recently merged?
(Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
repository.)
   
   Unfortunately not. In your patch, the overlay changes the color/face of 
   the
   whole line while my patch change the color/face of all parts of the line
   except for non-matching authors. With my patch non-matched autors were
  
  I understand now.
 
  
  This seems somewhat like a policy decision, though. If I indicate that I
  want the foreground text for a particular line to be red, should the
  formatting of non-matching authors override that?
  
  (My own approach has been to have `notmuch-search-line-faces' always
  specify a background colour whereas
  `notmuch-search-non-matching-authors' (or any of the columnar faces)
  specify a foreground colour and/or slant.)
 
 And now I even understand your patch. That's exactly what I wanted.
 Nice. I thought that overlays change completely the face of the line,
 hiding any faces under the overlay. Now I see, that
 notmuch-search-line-faces faces are combined with what was there
 before.

However, it seems that chaning :background in notmuch-search-line-faces
collides somewhat with hl-line-mode. If I move the point down to the
line with changed background, the line is not highlited. Only if I move
the point upwards, I see the line in green.

-Michal
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Do not color non-matching authors by tag

2010-11-05 Thread Jameson Rollins
On Fri, 05 Nov 2010 09:17:00 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
 However, it seems that chaning :background in notmuch-search-line-faces
 collides somewhat with hl-line-mode. If I move the point down to the
 line with changed background, the line is not highlited. Only if I move
 the point upwards, I see the line in green.

Hey, Michal.  I and some others have noticed this as well.  Not sure
what's going on, though.

jamie.


pgpZusuak5yMI.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Do not color non-matching authors by tag

2010-11-04 Thread Michal Sojka
Hi David,

On Thu, 04 Nov 2010, David Edmondson wrote:
> On Fri, 22 Oct 2010 07:42:02 +0200, Michal Sojka  
> wrote:
> > Customizing notmuch-search-line-faces to color lines in search result
> > according to tags has the effect that the color overrides other faces
> > set for the line. This is usually what the user wants with the
> > exception that it also colors non-matching authors and it is then not
> > possible to visually distinguish between matching and non-matching
> > authors.
> > 
> > This patch changes the way how are the faces specified in
> > notmuch-search-line-faces applied to the search results. In
> > particular, instead of adding an overlay for the whole line, the
> > existing faces of the line are replaced with what is given in
> > notmuch-search-line-faces. The only exception is that
> > notmuch-search-non-matching-authors face is never replaced.
> > 
> Michal, was this addressed by the patch that Carl recently merged?
> (Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
> repository.)

Unfortunately not. In your patch, the overlay changes the color/face of the
whole line while my patch change the color/face of all parts of the line
except for non-matching authors. With my patch non-matched autors were
always grayed even if the rest of line was colorized.

My patch no loger applies to the current HEAD. I plan to update it some
time later, but if you want to implement this, it would be great :-)

-Michal


[PATCH] emacs: Do not color non-matching authors by tag

2010-11-04 Thread David Edmondson
On Thu, 04 Nov 2010 15:12:53 +0100, Michal Sojka  wrote:
> > Michal, was this addressed by the patch that Carl recently merged?
> > (Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
> > repository.)
> 
> Unfortunately not. In your patch, the overlay changes the color/face of the
> whole line while my patch change the color/face of all parts of the line
> except for non-matching authors. With my patch non-matched autors were

I understand now.

This seems somewhat like a policy decision, though. If I indicate that I
want the foreground text for a particular line to be red, should the
formatting of non-matching authors override that?

(My own approach has been to have `notmuch-search-line-faces' always
specify a background colour whereas
`notmuch-search-non-matching-authors' (or any of the columnar faces)
specify a foreground colour and/or slant.)


[PATCH] emacs: Do not color non-matching authors by tag

2010-11-04 Thread David Edmondson
On Fri, 22 Oct 2010 07:42:02 +0200, Michal Sojka  wrote:
> Customizing notmuch-search-line-faces to color lines in search result
> according to tags has the effect that the color overrides other faces
> set for the line. This is usually what the user wants with the
> exception that it also colors non-matching authors and it is then not
> possible to visually distinguish between matching and non-matching
> authors.
> 
> This patch changes the way how are the faces specified in
> notmuch-search-line-faces applied to the search results. In
> particular, instead of adding an overlay for the whole line, the
> existing faces of the line are replaced with what is given in
> notmuch-search-line-faces. The only exception is that
> notmuch-search-non-matching-authors face is never replaced.
> 
> Signed-off-by: Michal Sojka 

Michal, was this addressed by the patch that Carl recently merged?
(Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
repository.)


Re: [PATCH] emacs: Do not color non-matching authors by tag

2010-11-04 Thread David Edmondson
On Fri, 22 Oct 2010 07:42:02 +0200, Michal Sojka sojk...@fel.cvut.cz wrote:
 Customizing notmuch-search-line-faces to color lines in search result
 according to tags has the effect that the color overrides other faces
 set for the line. This is usually what the user wants with the
 exception that it also colors non-matching authors and it is then not
 possible to visually distinguish between matching and non-matching
 authors.
 
 This patch changes the way how are the faces specified in
 notmuch-search-line-faces applied to the search results. In
 particular, instead of adding an overlay for the whole line, the
 existing faces of the line are replaced with what is given in
 notmuch-search-line-faces. The only exception is that
 notmuch-search-non-matching-authors face is never replaced.
 
 Signed-off-by: Michal Sojka sojk...@fel.cvut.cz

Michal, was this addressed by the patch that Carl recently merged?
(Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
repository.)
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Do not color non-matching authors by tag

2010-11-04 Thread David Edmondson
On Thu, 04 Nov 2010 15:12:53 +0100, Michal Sojka sojk...@fel.cvut.cz wrote:
  Michal, was this addressed by the patch that Carl recently merged?
  (Commit f99ad42da03afd638bfdfdea92d1cbdd3b510b8f in my copy of the
  repository.)
 
 Unfortunately not. In your patch, the overlay changes the color/face of the
 whole line while my patch change the color/face of all parts of the line
 except for non-matching authors. With my patch non-matched autors were

I understand now.

This seems somewhat like a policy decision, though. If I indicate that I
want the foreground text for a particular line to be red, should the
formatting of non-matching authors override that?

(My own approach has been to have `notmuch-search-line-faces' always
specify a background colour whereas
`notmuch-search-non-matching-authors' (or any of the columnar faces)
specify a foreground colour and/or slant.)
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Do not color non-matching authors by tag

2010-10-22 Thread Michal Sojka
Customizing notmuch-search-line-faces to color lines in search result
according to tags has the effect that the color overrides other faces
set for the line. This is usually what the user wants with the
exception that it also colors non-matching authors and it is then not
possible to visually distinguish between matching and non-matching
authors.

This patch changes the way how are the faces specified in
notmuch-search-line-faces applied to the search results. In
particular, instead of adding an overlay for the whole line, the
existing faces of the line are replaced with what is given in
notmuch-search-line-faces. The only exception is that
notmuch-search-non-matching-authors face is never replaced.

Signed-off-by: Michal Sojka 

---
 emacs/notmuch.el |   20 +---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 42619b2..d0fb834 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -593,17 +593,31 @@ matching will be applied."
   :type '(alist :key-type (string) :value-type (list))
   :group 'notmuch)

+(defun notmuch-search-set-line-face (start end face)
+  "Change face propery to value FACE expect for non-matching authors."
+  (save-excursion
+(save-restriction
+  (narrow-to-region start end)
+  (goto-char (point-min))
+  (let ((fstart (point))
+   fend)
+   (while (< fstart (point-max))
+ (setq fend (or (next-single-property-change fstart 'face)
+(point-max)))
+ (when (not (eq (get-text-property fstart 'face) 
'notmuch-search-non-matching-authors))
+   (put-text-property fstart fend 'face face))
+ (setq fstart fend))
+
 (defun notmuch-search-color-line (start end line-tag-list)
   "Colorize lines in notmuch-show based on tags"
   (if notmuch-search-line-faces
-  (let ((overlay (make-overlay start end))
-   (tags-faces (copy-alist notmuch-search-line-faces)))
+  (let ((tags-faces (copy-alist notmuch-search-line-faces)))
(while tags-faces
  (let* ((tag-face (car tags-faces))
 (tag (car tag-face))
 (face (cdr tag-face)))
(cond ((member tag line-tag-list)
-  (overlay-put overlay 'face face)
+  (notmuch-search-set-line-face start end face)
   (setq tags-faces nil))
  (t
   (setq tags-faces (cdr tags-faces)
-- 
tg: (f117d80..) t/do-not-colorize-non-matching-authors-by-tag (depends on: 
master)


[PATCH] emacs: Do not color non-matching authors by tag

2010-10-21 Thread Michal Sojka
Customizing notmuch-search-line-faces to color lines in search result
according to tags has the effect that the color overrides other faces
set for the line. This is usually what the user wants with the
exception that it also colors non-matching authors and it is then not
possible to visually distinguish between matching and non-matching
authors.

This patch changes the way how are the faces specified in
notmuch-search-line-faces applied to the search results. In
particular, instead of adding an overlay for the whole line, the
existing faces of the line are replaced with what is given in
notmuch-search-line-faces. The only exception is that
notmuch-search-non-matching-authors face is never replaced.

Signed-off-by: Michal Sojka sojk...@fel.cvut.cz

---
 emacs/notmuch.el |   20 +---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 42619b2..d0fb834 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -593,17 +593,31 @@ matching will be applied.
   :type '(alist :key-type (string) :value-type (list))
   :group 'notmuch)
 
+(defun notmuch-search-set-line-face (start end face)
+  Change face propery to value FACE expect for non-matching authors.
+  (save-excursion
+(save-restriction
+  (narrow-to-region start end)
+  (goto-char (point-min))
+  (let ((fstart (point))
+   fend)
+   (while ( fstart (point-max))
+ (setq fend (or (next-single-property-change fstart 'face)
+(point-max)))
+ (when (not (eq (get-text-property fstart 'face) 
'notmuch-search-non-matching-authors))
+   (put-text-property fstart fend 'face face))
+ (setq fstart fend))
+
 (defun notmuch-search-color-line (start end line-tag-list)
   Colorize lines in notmuch-show based on tags
   (if notmuch-search-line-faces
-  (let ((overlay (make-overlay start end))
-   (tags-faces (copy-alist notmuch-search-line-faces)))
+  (let ((tags-faces (copy-alist notmuch-search-line-faces)))
(while tags-faces
  (let* ((tag-face (car tags-faces))
 (tag (car tag-face))
 (face (cdr tag-face)))
(cond ((member tag line-tag-list)
-  (overlay-put overlay 'face face)
+  (notmuch-search-set-line-face start end face)
   (setq tags-faces nil))
  (t
   (setq tags-faces (cdr tags-faces)
-- 
tg: (f117d80..) t/do-not-colorize-non-matching-authors-by-tag (depends on: 
master)
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch