unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v2] emacs: add insisible space after the search widget field in notmuch-hello
       [not found] <id:1309762025-1172-1-git-send-email-dmitry.kurochkin@gmail.com>
@ 2011-07-04  8:27 ` Dmitry Kurochkin
  2011-07-04  8:55   ` Pieter Praet
  2011-11-12  0:08   ` Dmitry Kurochkin
  0 siblings, 2 replies; 6+ messages in thread
From: Dmitry Kurochkin @ 2011-07-04  8:27 UTC (permalink / raw)
  To: notmuch

It is very convenient when C-e (bound to `widget-end-of-line') ignores
trailing spaces inside the search widget.  But it only does so if a
widget is not followed by a newline (that is why it works in the saved
search widgets).  The patch just adds an insisible space after the
search widget to get the desirable behavior of `widget-end-of-line'.

Previous behavior of C-e:

  Search: [text                _]

Now:

  Search: [text_                ]

The extra space is also added to expected results of emacs tests.
---

Amended version with a better commit message.  Stolen from a similar
patch by Kan-Ru Chen [1] as suggested by Pieter Praet :)

Regards,
  Dmitry

[1] id:"1280195325-9066-2-git-send-email-kanru@kanru.info"

 emacs/notmuch-hello.el                             |    4 ++++
 test/emacs.expected-output/notmuch-hello           |    2 +-
 .../notmuch-hello-no-saved-searches                |    2 +-
 .../emacs.expected-output/notmuch-hello-with-empty |    2 +-
 4 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 65fde75..1a76c30 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -462,6 +462,10 @@ Complete list of currently available key bindings:
 				       (length "Search: ")))
 		       :action (lambda (widget &rest ignore)
 				 (notmuch-hello-search (widget-value widget))))
+	;; add an invisible space to make `widget-end-of-line' ignore
+	;; trailine spaces in the search widget field
+	(widget-insert " ")
+	(put-text-property (1- (point)) (point) 'invisible t)
 	(widget-insert "\n")
 
 	(when notmuch-hello-recent-searches
diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello
index 64b7e42..48143bd 100644
--- a/test/emacs.expected-output/notmuch-hello
+++ b/test/emacs.expected-output/notmuch-hello
@@ -4,7 +4,7 @@ Saved searches: [edit]
 
 	  50 inbox           50 unread    
 
-Search:                                                                     
+Search:                                                                      
 
 [Show all tags]
 
diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches b/test/emacs.expected-output/notmuch-hello-no-saved-searches
index 7f8206a..7c09e40 100644
--- a/test/emacs.expected-output/notmuch-hello-no-saved-searches
+++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches
@@ -1,6 +1,6 @@
    Welcome to notmuch. You have 50 messages.
 
-Search:                                                                     
+Search:                                                                      
 
 [Show all tags]
 
diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty
index a9ed630..2a267c9 100644
--- a/test/emacs.expected-output/notmuch-hello-with-empty
+++ b/test/emacs.expected-output/notmuch-hello-with-empty
@@ -4,7 +4,7 @@ Saved searches: [edit]
 
 	  50 inbox           50 unread           0 empty     
 
-Search:                                                                     
+Search:                                                                      
 
 [Show all tags]
 
-- 
1.7.5.4

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

* Re: [PATCH v2] emacs: add insisible space after the search widget field in notmuch-hello
  2011-07-04  8:27 ` [PATCH v2] emacs: add insisible space after the search widget field in notmuch-hello Dmitry Kurochkin
@ 2011-07-04  8:55   ` Pieter Praet
  2011-07-04  9:08     ` Dmitry Kurochkin
  2011-11-12  0:08   ` Dmitry Kurochkin
  1 sibling, 1 reply; 6+ messages in thread
From: Pieter Praet @ 2011-07-04  8:55 UTC (permalink / raw)
  To: Dmitry Kurochkin, notmuch

On Mon,  4 Jul 2011 12:27:04 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> It is very convenient when C-e (bound to `widget-end-of-line') ignores
> trailing spaces inside the search widget.  But it only does so if a
> widget is not followed by a newline (that is why it works in the saved
> search widgets).  The patch just adds an insisible space after the
> search widget to get the desirable behavior of `widget-end-of-line'.
> 
> Previous behavior of C-e:
> 
>   Search: [text                _]
> 
> Now:
> 
>   Search: [text_                ]
> 
> The extra space is also added to expected results of emacs tests.
> ---
> 
> Amended version with a better commit message.  Stolen from a similar
> patch by Kan-Ru Chen [1] as suggested by Pieter Praet :)

Muhahaaa!

> Regards,
>   Dmitry
> 
> [1] id:"1280195325-9066-2-git-send-email-kanru@kanru.info"
> 
>  emacs/notmuch-hello.el                             |    4 ++++
>  test/emacs.expected-output/notmuch-hello           |    2 +-
>  .../notmuch-hello-no-saved-searches                |    2 +-
>  .../emacs.expected-output/notmuch-hello-with-empty |    2 +-
>  4 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index 65fde75..1a76c30 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -462,6 +462,10 @@ Complete list of currently available key bindings:
>  				       (length "Search: ")))
>  		       :action (lambda (widget &rest ignore)
>  				 (notmuch-hello-search (widget-value widget))))
> +	;; add an invisible space to make `widget-end-of-line' ignore
> +	;; trailine spaces in the search widget field
> +	(widget-insert " ")
> +	(put-text-property (1- (point)) (point) 'invisible t)
>  	(widget-insert "\n")
>  
>  	(when notmuch-hello-recent-searches
> diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello
> index 64b7e42..48143bd 100644
> --- a/test/emacs.expected-output/notmuch-hello
> +++ b/test/emacs.expected-output/notmuch-hello
> @@ -4,7 +4,7 @@ Saved searches: [edit]
>  
>  	  50 inbox           50 unread    
>  
> -Search:                                                                     
> +Search:                                                                      
>  
>  [Show all tags]
>  
> diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches b/test/emacs.expected-output/notmuch-hello-no-saved-searches
> index 7f8206a..7c09e40 100644
> --- a/test/emacs.expected-output/notmuch-hello-no-saved-searches
> +++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches
> @@ -1,6 +1,6 @@
>     Welcome to notmuch. You have 50 messages.
>  
> -Search:                                                                     
> +Search:                                                                      
>  
>  [Show all tags]
>  
> diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty
> index a9ed630..2a267c9 100644
> --- a/test/emacs.expected-output/notmuch-hello-with-empty
> +++ b/test/emacs.expected-output/notmuch-hello-with-empty
> @@ -4,7 +4,7 @@ Saved searches: [edit]
>  
>  	  50 inbox           50 unread           0 empty     
>  
> -Search:                                                                     
> +Search:                                                                      
>  
>  [Show all tags]
>  
> -- 
> 1.7.5.4
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Signed-off-by: Pieter Praet <pieter@praet.org>


Would this be the right place to promote two of your previous patches [1,2] ?

They serve as ears when using eye protection against `show-trailing-whitespace'.


Peace

-- 
Pieter

[1] id:"1278000507-22290-5-git-send-email-dmitry.kurochkin@gmail.com"
[2] id:"1278000507-22290-6-git-send-email-dmitry.kurochkin@gmail.com"

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

* Re: [PATCH v2] emacs: add insisible space after the search widget field in notmuch-hello
  2011-07-04  8:55   ` Pieter Praet
@ 2011-07-04  9:08     ` Dmitry Kurochkin
  2011-07-04  9:47       ` Pieter Praet
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitry Kurochkin @ 2011-07-04  9:08 UTC (permalink / raw)
  To: Pieter Praet, notmuch

On Mon, 04 Jul 2011 10:55:21 +0200, Pieter Praet <pieter@praet.org> wrote:
> On Mon,  4 Jul 2011 12:27:04 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> > It is very convenient when C-e (bound to `widget-end-of-line') ignores
> > trailing spaces inside the search widget.  But it only does so if a
> > widget is not followed by a newline (that is why it works in the saved
> > search widgets).  The patch just adds an insisible space after the
> > search widget to get the desirable behavior of `widget-end-of-line'.
> > 
> > Previous behavior of C-e:
> > 
> >   Search: [text                _]
> > 
> > Now:
> > 
> >   Search: [text_                ]
> > 
> > The extra space is also added to expected results of emacs tests.
> > ---
> > 
> > Amended version with a better commit message.  Stolen from a similar
> > patch by Kan-Ru Chen [1] as suggested by Pieter Praet :)
> 
> Muhahaaa!
> 
> > Regards,
> >   Dmitry
> > 
> > [1] id:"1280195325-9066-2-git-send-email-kanru@kanru.info"
> > 
> >  emacs/notmuch-hello.el                             |    4 ++++
> >  test/emacs.expected-output/notmuch-hello           |    2 +-
> >  .../notmuch-hello-no-saved-searches                |    2 +-
> >  .../emacs.expected-output/notmuch-hello-with-empty |    2 +-
> >  4 files changed, 7 insertions(+), 3 deletions(-)
> > 
> > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> > index 65fde75..1a76c30 100644
> > --- a/emacs/notmuch-hello.el
> > +++ b/emacs/notmuch-hello.el
> > @@ -462,6 +462,10 @@ Complete list of currently available key bindings:
> >  				       (length "Search: ")))
> >  		       :action (lambda (widget &rest ignore)
> >  				 (notmuch-hello-search (widget-value widget))))
> > +	;; add an invisible space to make `widget-end-of-line' ignore
> > +	;; trailine spaces in the search widget field
> > +	(widget-insert " ")
> > +	(put-text-property (1- (point)) (point) 'invisible t)
> >  	(widget-insert "\n")
> >  
> >  	(when notmuch-hello-recent-searches
> > diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello
> > index 64b7e42..48143bd 100644
> > --- a/test/emacs.expected-output/notmuch-hello
> > +++ b/test/emacs.expected-output/notmuch-hello
> > @@ -4,7 +4,7 @@ Saved searches: [edit]
> >  
> >  	  50 inbox           50 unread    
> >  
> > -Search:                                                                     
> > +Search:                                                                      
> >  
> >  [Show all tags]
> >  
> > diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches b/test/emacs.expected-output/notmuch-hello-no-saved-searches
> > index 7f8206a..7c09e40 100644
> > --- a/test/emacs.expected-output/notmuch-hello-no-saved-searches
> > +++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches
> > @@ -1,6 +1,6 @@
> >     Welcome to notmuch. You have 50 messages.
> >  
> > -Search:                                                                     
> > +Search:                                                                      
> >  
> >  [Show all tags]
> >  
> > diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty
> > index a9ed630..2a267c9 100644
> > --- a/test/emacs.expected-output/notmuch-hello-with-empty
> > +++ b/test/emacs.expected-output/notmuch-hello-with-empty
> > @@ -4,7 +4,7 @@ Saved searches: [edit]
> >  
> >  	  50 inbox           50 unread           0 empty     
> >  
> > -Search:                                                                     
> > +Search:                                                                      
> >  
> >  [Show all tags]
> >  
> > -- 
> > 1.7.5.4
> > 
> > _______________________________________________
> > notmuch mailing list
> > notmuch@notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch
> 
> Signed-off-by: Pieter Praet <pieter@praet.org>
> 
> 
> Would this be the right place to promote two of your previous patches [1,2] ?
> 
> They serve as ears when using eye protection against `show-trailing-whitespace'.
> 

I am glad somebody uses it except for me :)  I use them exactly for the
same reason.

They are not ready for mainline.  Two issues:

* Poor commit message should be improved to make Carl happy.

* I have wrote them long ago, and I am not sure it is a proper
  implementation.  I need to double check that before asking Carl to
  push it.  Or somebody else with a better elisp knowledge should review
  and approve it.

I have been delaying this for some time.  Since now I know somebody
actually uses it, I may get to it sooner rather than later.  But no
promises.

BTW I am not really sure that hooks are the best solution for turning
off `show-trailing-whitespace'.  Perhaps there is a better way?  Would
appreciate comments.  (Though, hooks would be useful anyway.)

Regards,
  Dmitry

> 
> Peace
> 
> -- 
> Pieter
> 
> [1] id:"1278000507-22290-5-git-send-email-dmitry.kurochkin@gmail.com"
> [2] id:"1278000507-22290-6-git-send-email-dmitry.kurochkin@gmail.com"

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

* Re: [PATCH v2] emacs: add insisible space after the search widget field in notmuch-hello
  2011-07-04  9:08     ` Dmitry Kurochkin
@ 2011-07-04  9:47       ` Pieter Praet
  0 siblings, 0 replies; 6+ messages in thread
From: Pieter Praet @ 2011-07-04  9:47 UTC (permalink / raw)
  To: Dmitry Kurochkin, notmuch

On Mon, 04 Jul 2011 13:08:43 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> On Mon, 04 Jul 2011 10:55:21 +0200, Pieter Praet <pieter@praet.org> wrote:
> > On Mon,  4 Jul 2011 12:27:04 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> > > It is very convenient when C-e (bound to `widget-end-of-line') ignores
> > > trailing spaces inside the search widget.  But it only does so if a
> > > widget is not followed by a newline (that is why it works in the saved
> > > search widgets).  The patch just adds an insisible space after the
> > > search widget to get the desirable behavior of `widget-end-of-line'.
> > > 
> > > Previous behavior of C-e:
> > > 
> > >   Search: [text                _]
> > > 
> > > Now:
> > > 
> > >   Search: [text_                ]
> > > 
> > > The extra space is also added to expected results of emacs tests.
> > > ---
> > > 
> > > Amended version with a better commit message.  Stolen from a similar
> > > patch by Kan-Ru Chen [1] as suggested by Pieter Praet :)
> > 
> > Muhahaaa!
> > 
> > > Regards,
> > >   Dmitry
> > > 
> > > [1] id:"1280195325-9066-2-git-send-email-kanru@kanru.info"
> > > 
> > >  emacs/notmuch-hello.el                             |    4 ++++
> > >  test/emacs.expected-output/notmuch-hello           |    2 +-
> > >  .../notmuch-hello-no-saved-searches                |    2 +-
> > >  .../emacs.expected-output/notmuch-hello-with-empty |    2 +-
> > >  4 files changed, 7 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> > > index 65fde75..1a76c30 100644
> > > --- a/emacs/notmuch-hello.el
> > > +++ b/emacs/notmuch-hello.el
> > > @@ -462,6 +462,10 @@ Complete list of currently available key bindings:
> > >  				       (length "Search: ")))
> > >  		       :action (lambda (widget &rest ignore)
> > >  				 (notmuch-hello-search (widget-value widget))))
> > > +	;; add an invisible space to make `widget-end-of-line' ignore
> > > +	;; trailine spaces in the search widget field
> > > +	(widget-insert " ")
> > > +	(put-text-property (1- (point)) (point) 'invisible t)
> > >  	(widget-insert "\n")
> > >  
> > >  	(when notmuch-hello-recent-searches
> > > diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello
> > > index 64b7e42..48143bd 100644
> > > --- a/test/emacs.expected-output/notmuch-hello
> > > +++ b/test/emacs.expected-output/notmuch-hello
> > > @@ -4,7 +4,7 @@ Saved searches: [edit]
> > >  
> > >  	  50 inbox           50 unread    
> > >  
> > > -Search:                                                                     
> > > +Search:                                                                      
> > >  
> > >  [Show all tags]
> > >  
> > > diff --git a/test/emacs.expected-output/notmuch-hello-no-saved-searches b/test/emacs.expected-output/notmuch-hello-no-saved-searches
> > > index 7f8206a..7c09e40 100644
> > > --- a/test/emacs.expected-output/notmuch-hello-no-saved-searches
> > > +++ b/test/emacs.expected-output/notmuch-hello-no-saved-searches
> > > @@ -1,6 +1,6 @@
> > >     Welcome to notmuch. You have 50 messages.
> > >  
> > > -Search:                                                                     
> > > +Search:                                                                      
> > >  
> > >  [Show all tags]
> > >  
> > > diff --git a/test/emacs.expected-output/notmuch-hello-with-empty b/test/emacs.expected-output/notmuch-hello-with-empty
> > > index a9ed630..2a267c9 100644
> > > --- a/test/emacs.expected-output/notmuch-hello-with-empty
> > > +++ b/test/emacs.expected-output/notmuch-hello-with-empty
> > > @@ -4,7 +4,7 @@ Saved searches: [edit]
> > >  
> > >  	  50 inbox           50 unread           0 empty     
> > >  
> > > -Search:                                                                     
> > > +Search:                                                                      
> > >  
> > >  [Show all tags]
> > >  
> > > -- 
> > > 1.7.5.4
> > > 
> > > _______________________________________________
> > > notmuch mailing list
> > > notmuch@notmuchmail.org
> > > http://notmuchmail.org/mailman/listinfo/notmuch
> > 
> > Signed-off-by: Pieter Praet <pieter@praet.org>
> > 
> > 
> > Would this be the right place to promote two of your previous patches [1,2] ?
> > 
> > They serve as ears when using eye protection against `show-trailing-whitespace'.
> > 
> 
> I am glad somebody uses it except for me :)  I use them exactly for the
> same reason.
> 
> They are not ready for mainline.  Two issues:
> 
> * Poor commit message should be improved to make Carl happy.

Rather skimpy indeed (as in non-existent) but I think the mere act of
inserting "\n" at the right point in their titles would provide a fairly
descriptive commit msg.

> * I have wrote them long ago, and I am not sure it is a proper
>   implementation.  I need to double check that before asking Carl to
>   push it.  Or somebody else with a better elisp knowledge should review
>   and approve it.
> 
> I have been delaying this for some time.  Since now I know somebody
> actually uses it, I may get to it sooner rather than later.  But no
> promises.

No promises? I demand a full refund!

> BTW I am not really sure that hooks are the best solution for turning
> off `show-trailing-whitespace'.  Perhaps there is a better way?  Would
> appreciate comments.  (Though, hooks would be useful anyway.)

I (humbly) assert that hooks cure both the sniffles and cancer.

Why install a sink, when one could instead provide the means to install
an entire kitchen? People *will* reciprocate with patches for mainline,
as previous threads have thoroughly proven. Even more so, I'd argue,
since experimentation is facilitated.

> Regards,
>   Dmitry
> 
> > 
> > Peace
> > 
> > -- 
> > Pieter
> > 
> > [1] id:"1278000507-22290-5-git-send-email-dmitry.kurochkin@gmail.com"
> > [2] id:"1278000507-22290-6-git-send-email-dmitry.kurochkin@gmail.com"


Peace

-- 
Pieter

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

* Re: [PATCH v2] emacs: add insisible space after the search widget field in notmuch-hello
  2011-07-04  8:27 ` [PATCH v2] emacs: add insisible space after the search widget field in notmuch-hello Dmitry Kurochkin
  2011-07-04  8:55   ` Pieter Praet
@ 2011-11-12  0:08   ` Dmitry Kurochkin
  2011-11-16 10:59     ` Pieter Praet
  1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Kurochkin @ 2011-11-12  0:08 UTC (permalink / raw)
  To: notmuch

Hi all.

Any objections to this trivial patch?  Can we get it pushed?

Regards,
  Dmitry

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

* Re: [PATCH v2] emacs: add insisible space after the search widget field in notmuch-hello
  2011-11-12  0:08   ` Dmitry Kurochkin
@ 2011-11-16 10:59     ` Pieter Praet
  0 siblings, 0 replies; 6+ messages in thread
From: Pieter Praet @ 2011-11-16 10:59 UTC (permalink / raw)
  To: Dmitry Kurochkin, notmuch

On Sat, 12 Nov 2011 04:08:45 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> Hi all.
> 
> Any objections to this trivial patch?  Can we get it pushed?
> 

Appears to have been deprecated in favor of the original patch:
id:"1309762025-1172-1-git-send-email-dmitry.kurochkin@gmail.com"

See commit e972d752.

> Regards,
>   Dmitry
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Peace

-- 
Pieter

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

end of thread, other threads:[~2011-11-16 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <id:1309762025-1172-1-git-send-email-dmitry.kurochkin@gmail.com>
2011-07-04  8:27 ` [PATCH v2] emacs: add insisible space after the search widget field in notmuch-hello Dmitry Kurochkin
2011-07-04  8:55   ` Pieter Praet
2011-07-04  9:08     ` Dmitry Kurochkin
2011-07-04  9:47       ` Pieter Praet
2011-11-12  0:08   ` Dmitry Kurochkin
2011-11-16 10:59     ` Pieter Praet

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