unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Fix display of highlighted line in notmuch-show
@ 2012-02-14 10:24 Michal Sojka
  2012-02-14 15:27 ` Austin Clements
  2012-02-14 16:56 ` Jani Nikula
  0 siblings, 2 replies; 9+ messages in thread
From: Michal Sojka @ 2012-02-14 10:24 UTC (permalink / raw)
  To: notmuch; +Cc: Michal Sojka

When notmuch-search-line-faces is used to set background color in search
results, the highlight of the current line is not always displayed
correctly. This patch fixes that by increasing the priority property of
the highlight overlay.
---
 emacs/notmuch.el |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5b4f1c5..f851c6f 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -249,10 +249,17 @@ For a mouse binding, return nil."
       (set-buffer-modified-p nil)
       (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))
 
-(defcustom notmuch-search-hook '(hl-line-mode)
+(require 'hl-line)
+
+(defun notmuch-hl-line-mode ()
+  (prog1 (hl-line-mode)
+    (when hl-line-overlay
+      (overlay-put hl-line-overlay 'priority 1))))
+
+(defcustom notmuch-search-hook '(notmuch-hl-line-mode)
   "List of functions to call when notmuch displays the search results."
   :type 'hook
-  :options '(hl-line-mode)
+  :options '(notmuch-hl-line-mode)
   :group 'notmuch-search
   :group 'notmuch-hooks)
 
@@ -567,7 +574,7 @@ a list of strings of the form \"+TAG\" or \"-TAG\".
 the messages that are about to be tagged"
 
   :type 'hook
-  :options '(hl-line-mode)
+  :options '(notmuch-hl-line-mode)
   :group 'notmuch-hooks)
 
 (defcustom notmuch-after-tag-hook nil
@@ -578,7 +585,7 @@ a list of strings of the form \"+TAG\" or \"-TAG\".
 'query' will be a string containing the search query that determines
 the messages that were tagged"
   :type 'hook
-  :options '(hl-line-mode)
+  :options '(notmuch-hl-line-mode)
   :group 'notmuch-hooks)
 
 (defun notmuch-search-set-tags (tags)
-- 
1.7.7.3

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

* Re: [PATCH] emacs: Fix display of highlighted line in notmuch-show
  2012-02-14 10:24 [PATCH] emacs: Fix display of highlighted line in notmuch-show Michal Sojka
@ 2012-02-14 15:27 ` Austin Clements
  2012-02-14 16:56 ` Jani Nikula
  1 sibling, 0 replies; 9+ messages in thread
From: Austin Clements @ 2012-02-14 15:27 UTC (permalink / raw)
  To: Michal Sojka; +Cc: notmuch

Quoth Michal Sojka on Feb 14 at 11:24 am:
> When notmuch-search-line-faces is used to set background color in search
> results, the highlight of the current line is not always displayed
> correctly. This patch fixes that by increasing the priority property of
> the highlight overlay.

LGTM.  Too bad hl-line doesn't have a mode hook we could do this in.

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

* Re: [PATCH] emacs: Fix display of highlighted line in notmuch-show
  2012-02-14 10:24 [PATCH] emacs: Fix display of highlighted line in notmuch-show Michal Sojka
  2012-02-14 15:27 ` Austin Clements
@ 2012-02-14 16:56 ` Jani Nikula
  2012-02-14 17:09   ` [PATCH v2] emacs: Fix display of highlighted line in notmuch-search Michal Sojka
  1 sibling, 1 reply; 9+ messages in thread
From: Jani Nikula @ 2012-02-14 16:56 UTC (permalink / raw)
  To: Michal Sojka, notmuch; +Cc: Michal Sojka

On Tue, 14 Feb 2012 11:24:16 +0100, Michal Sojka <sojka@os.inf.tu-dresden.de> wrote:
> When notmuch-search-line-faces is used to set background color in search
> results, the highlight of the current line is not always displayed
> correctly. This patch fixes that by increasing the priority property of
> the highlight overlay.

One nitpick: The subject line refers to notmuch-show.

BR,
Jani.

> ---
>  emacs/notmuch.el |   15 +++++++++++----
>  1 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 5b4f1c5..f851c6f 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -249,10 +249,17 @@ For a mouse binding, return nil."
>        (set-buffer-modified-p nil)
>        (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))
>  
> -(defcustom notmuch-search-hook '(hl-line-mode)
> +(require 'hl-line)
> +
> +(defun notmuch-hl-line-mode ()
> +  (prog1 (hl-line-mode)
> +    (when hl-line-overlay
> +      (overlay-put hl-line-overlay 'priority 1))))
> +
> +(defcustom notmuch-search-hook '(notmuch-hl-line-mode)
>    "List of functions to call when notmuch displays the search results."
>    :type 'hook
> -  :options '(hl-line-mode)
> +  :options '(notmuch-hl-line-mode)
>    :group 'notmuch-search
>    :group 'notmuch-hooks)
>  
> @@ -567,7 +574,7 @@ a list of strings of the form \"+TAG\" or \"-TAG\".
>  the messages that are about to be tagged"
>  
>    :type 'hook
> -  :options '(hl-line-mode)
> +  :options '(notmuch-hl-line-mode)
>    :group 'notmuch-hooks)
>  
>  (defcustom notmuch-after-tag-hook nil
> @@ -578,7 +585,7 @@ a list of strings of the form \"+TAG\" or \"-TAG\".
>  'query' will be a string containing the search query that determines
>  the messages that were tagged"
>    :type 'hook
> -  :options '(hl-line-mode)
> +  :options '(notmuch-hl-line-mode)
>    :group 'notmuch-hooks)
>  
>  (defun notmuch-search-set-tags (tags)
> -- 
> 1.7.7.3
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* [PATCH v2] emacs: Fix display of highlighted line in notmuch-search
  2012-02-14 16:56 ` Jani Nikula
@ 2012-02-14 17:09   ` Michal Sojka
  2012-02-15 10:23     ` Tomi Ollila
                       ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Michal Sojka @ 2012-02-14 17:09 UTC (permalink / raw)
  To: notmuch; +Cc: Michal Sojka

When notmuch-search-line-faces is used to set background color in search
results, the highlight of the current line is not always displayed
correctly. This patch fixes that by increasing the priority property of
the highlight overlay.
---
 emacs/notmuch.el |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 5b4f1c5..f851c6f 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -249,10 +249,17 @@ For a mouse binding, return nil."
       (set-buffer-modified-p nil)
       (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))
 
-(defcustom notmuch-search-hook '(hl-line-mode)
+(require 'hl-line)
+
+(defun notmuch-hl-line-mode ()
+  (prog1 (hl-line-mode)
+    (when hl-line-overlay
+      (overlay-put hl-line-overlay 'priority 1))))
+
+(defcustom notmuch-search-hook '(notmuch-hl-line-mode)
   "List of functions to call when notmuch displays the search results."
   :type 'hook
-  :options '(hl-line-mode)
+  :options '(notmuch-hl-line-mode)
   :group 'notmuch-search
   :group 'notmuch-hooks)
 
@@ -567,7 +574,7 @@ a list of strings of the form \"+TAG\" or \"-TAG\".
 the messages that are about to be tagged"
 
   :type 'hook
-  :options '(hl-line-mode)
+  :options '(notmuch-hl-line-mode)
   :group 'notmuch-hooks)
 
 (defcustom notmuch-after-tag-hook nil
@@ -578,7 +585,7 @@ a list of strings of the form \"+TAG\" or \"-TAG\".
 'query' will be a string containing the search query that determines
 the messages that were tagged"
   :type 'hook
-  :options '(hl-line-mode)
+  :options '(notmuch-hl-line-mode)
   :group 'notmuch-hooks)
 
 (defun notmuch-search-set-tags (tags)
-- 
1.7.7.3

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

* Re: [PATCH v2] emacs: Fix display of highlighted line in notmuch-search
  2012-02-14 17:09   ` [PATCH v2] emacs: Fix display of highlighted line in notmuch-search Michal Sojka
@ 2012-02-15 10:23     ` Tomi Ollila
  2012-02-15 19:27     ` Dmitry Kurochkin
  2012-02-17 12:09     ` David Bremner
  2 siblings, 0 replies; 9+ messages in thread
From: Tomi Ollila @ 2012-02-15 10:23 UTC (permalink / raw)
  To: Michal Sojka, notmuch

On Tue, 14 Feb 2012 18:09:47 +0100, Michal Sojka <sojka@os.inf.tu-dresden.de> wrote:
> When notmuch-search-line-faces is used to set background color in search
> results, the highlight of the current line is not always displayed
> correctly. This patch fixes that by increasing the priority property of
> the highlight overlay.
> ---

+1

Tomi

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

* Re: [PATCH v2] emacs: Fix display of highlighted line in notmuch-search
  2012-02-14 17:09   ` [PATCH v2] emacs: Fix display of highlighted line in notmuch-search Michal Sojka
  2012-02-15 10:23     ` Tomi Ollila
@ 2012-02-15 19:27     ` Dmitry Kurochkin
  2012-02-15 23:18       ` Michal Sojka
  2012-02-17 12:09     ` David Bremner
  2 siblings, 1 reply; 9+ messages in thread
From: Dmitry Kurochkin @ 2012-02-15 19:27 UTC (permalink / raw)
  To: Michal Sojka, notmuch

Hi Michal.

On Tue, 14 Feb 2012 18:09:47 +0100, Michal Sojka <sojka@os.inf.tu-dresden.de> wrote:
> When notmuch-search-line-faces is used to set background color in search
> results, the highlight of the current line is not always displayed
> correctly. This patch fixes that by increasing the priority property of
> the highlight overlay.
> ---

How about changing `notmuch-search-color-line' to use text properties
instead of overlays?  Then hl-line overlay would take priority over it
without these changes.

See [1] by David Edmondson on why text properties are better in
general.  I plan to use text properties here to simplify updating the
face when tags are changed.

Regards,
  Dmitry

[1] id:"1328604377-20121-2-git-send-email-dme@dme.org"

>  emacs/notmuch.el |   15 +++++++++++----
>  1 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 5b4f1c5..f851c6f 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -249,10 +249,17 @@ For a mouse binding, return nil."
>        (set-buffer-modified-p nil)
>        (view-buffer (current-buffer) 'kill-buffer-if-not-modified))))
>  
> -(defcustom notmuch-search-hook '(hl-line-mode)
> +(require 'hl-line)
> +
> +(defun notmuch-hl-line-mode ()
> +  (prog1 (hl-line-mode)
> +    (when hl-line-overlay
> +      (overlay-put hl-line-overlay 'priority 1))))
> +
> +(defcustom notmuch-search-hook '(notmuch-hl-line-mode)
>    "List of functions to call when notmuch displays the search results."
>    :type 'hook
> -  :options '(hl-line-mode)
> +  :options '(notmuch-hl-line-mode)
>    :group 'notmuch-search
>    :group 'notmuch-hooks)
>  
> @@ -567,7 +574,7 @@ a list of strings of the form \"+TAG\" or \"-TAG\".
>  the messages that are about to be tagged"
>  
>    :type 'hook
> -  :options '(hl-line-mode)
> +  :options '(notmuch-hl-line-mode)
>    :group 'notmuch-hooks)
>  
>  (defcustom notmuch-after-tag-hook nil
> @@ -578,7 +585,7 @@ a list of strings of the form \"+TAG\" or \"-TAG\".
>  'query' will be a string containing the search query that determines
>  the messages that were tagged"
>    :type 'hook
> -  :options '(hl-line-mode)
> +  :options '(notmuch-hl-line-mode)
>    :group 'notmuch-hooks)
>  
>  (defun notmuch-search-set-tags (tags)
> -- 
> 1.7.7.3
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH v2] emacs: Fix display of highlighted line in notmuch-search
  2012-02-15 19:27     ` Dmitry Kurochkin
@ 2012-02-15 23:18       ` Michal Sojka
  2012-02-15 23:25         ` Dmitry Kurochkin
  0 siblings, 1 reply; 9+ messages in thread
From: Michal Sojka @ 2012-02-15 23:18 UTC (permalink / raw)
  To: Dmitry Kurochkin, notmuch

On Wed, 15 Feb 2012, Dmitry Kurochkin wrote:
> Hi Michal.
> 
> On Tue, 14 Feb 2012 18:09:47 +0100, Michal Sojka <sojka@os.inf.tu-dresden.de> wrote:
> > When notmuch-search-line-faces is used to set background color in search
> > results, the highlight of the current line is not always displayed
> > correctly. This patch fixes that by increasing the priority property of
> > the highlight overlay.
> > ---
> 
> How about changing `notmuch-search-color-line' to use text properties
> instead of overlays?  Then hl-line overlay would take priority over it
> without these changes.
> 
> See [1] by David Edmondson on why text properties are better in
> general.  I plan to use text properties here to simplify updating the
> face when tags are changed.

Hmm, I always wondered why notmuch uses overlays even if Elisp manual
says they don't scale. I remember that I wanted to replace that long
time ago, but there was some problem, which I forgot. Maybe it was the
invisibility David mentions. I guess there is some invisible text in
search output, isn't it?

-Michal

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

* Re: [PATCH v2] emacs: Fix display of highlighted line in notmuch-search
  2012-02-15 23:18       ` Michal Sojka
@ 2012-02-15 23:25         ` Dmitry Kurochkin
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Kurochkin @ 2012-02-15 23:25 UTC (permalink / raw)
  To: Michal Sojka, notmuch

On Thu, 16 Feb 2012 00:18:31 +0100, Michal Sojka <sojka@os.inf.tu-dresden.de> wrote:
> On Wed, 15 Feb 2012, Dmitry Kurochkin wrote:
> > Hi Michal.
> > 
> > On Tue, 14 Feb 2012 18:09:47 +0100, Michal Sojka <sojka@os.inf.tu-dresden.de> wrote:
> > > When notmuch-search-line-faces is used to set background color in search
> > > results, the highlight of the current line is not always displayed
> > > correctly. This patch fixes that by increasing the priority property of
> > > the highlight overlay.
> > > ---
> > 
> > How about changing `notmuch-search-color-line' to use text properties
> > instead of overlays?  Then hl-line overlay would take priority over it
> > without these changes.
> > 
> > See [1] by David Edmondson on why text properties are better in
> > general.  I plan to use text properties here to simplify updating the
> > face when tags are changed.
> 
> Hmm, I always wondered why notmuch uses overlays even if Elisp manual
> says they don't scale. I remember that I wanted to replace that long
> time ago, but there was some problem, which I forgot. Maybe it was the
> invisibility David mentions. I guess there is some invisible text in
> search output, isn't it?
> 

Yes.  Also other faces (e.g. date, subject) are used in search.  If we
used properties in `notmuch-search-color-line', we would have to merge
with other properties.  So I take my proposal back.

Regards,
  Dmitry

> -Michal

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

* Re: [PATCH v2] emacs: Fix display of highlighted line in notmuch-search
  2012-02-14 17:09   ` [PATCH v2] emacs: Fix display of highlighted line in notmuch-search Michal Sojka
  2012-02-15 10:23     ` Tomi Ollila
  2012-02-15 19:27     ` Dmitry Kurochkin
@ 2012-02-17 12:09     ` David Bremner
  2 siblings, 0 replies; 9+ messages in thread
From: David Bremner @ 2012-02-17 12:09 UTC (permalink / raw)
  To: Michal Sojka, notmuch; +Cc: Michal Sojka

On Tue, 14 Feb 2012 18:09:47 +0100, Michal Sojka <sojka@os.inf.tu-dresden.de> wrote:
> When notmuch-search-line-faces is used to set background color in search
> results, the highlight of the current line is not always displayed
> correctly. This patch fixes that by increasing the priority property of
> the highlight overlay.
> ---

Pushed, 

d

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

end of thread, other threads:[~2012-02-17 12:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-14 10:24 [PATCH] emacs: Fix display of highlighted line in notmuch-show Michal Sojka
2012-02-14 15:27 ` Austin Clements
2012-02-14 16:56 ` Jani Nikula
2012-02-14 17:09   ` [PATCH v2] emacs: Fix display of highlighted line in notmuch-search Michal Sojka
2012-02-15 10:23     ` Tomi Ollila
2012-02-15 19:27     ` Dmitry Kurochkin
2012-02-15 23:18       ` Michal Sojka
2012-02-15 23:25         ` Dmitry Kurochkin
2012-02-17 12:09     ` David Bremner

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