emacs: add invisible space after the search widget field in notmuch-hello
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Mon, 4 Jul 2011 06:47:05 +0000 (10:47 +0400)
committerDavid Bremner <bremner@debian.org>
Sat, 12 Nov 2011 15:34:53 +0000 (10:34 -0500)
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 invisible space after the
search widget to get the desirable behavior of `widget-end-of-line'.
The extra space is also added to expected results of emacs tests.

emacs/notmuch-hello.el
test/emacs.expected-output/notmuch-hello
test/emacs.expected-output/notmuch-hello-no-saved-searches
test/emacs.expected-output/notmuch-hello-with-empty

index 65fde75a07d3b3ad10179315941c29ab0a26bacb..1a76c30abed9d79eafe1da8c30acc9ad5bf93561 100644 (file)
@@ -462,6 +462,10 @@ Complete list of currently available key bindings:
                                       (length "Search: ")))
                       :action (lambda (widget &rest ignore)
                                 (notmuch-hello-search (widget-value widget))))
                                       (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
        (widget-insert "\n")
 
        (when notmuch-hello-recent-searches
index 64b7e42c31770fd1fd9b345d3437f8cd6f6e4616..48143bd73055a07f7f3394ca95f9f16ca053335f 100644 (file)
@@ -4,7 +4,7 @@ Saved searches: [edit]
 
          50 inbox           50 unread    
 
 
          50 inbox           50 unread    
 
-Search:                                                                     
+Search:                                                                      
 
 [Show all tags]
 
 
 [Show all tags]
 
index 7f8206aaffa1f97de82438a20ee838c8abac7633..7c09e40bcef121d778fcf72f7a1676269e7fcf93 100644 (file)
@@ -1,6 +1,6 @@
    Welcome to notmuch. You have 50 messages.
 
    Welcome to notmuch. You have 50 messages.
 
-Search:                                                                     
+Search:                                                                      
 
 [Show all tags]
 
 
 [Show all tags]
 
index a9ed63044fd9ef3978cff9d5b8950292224414b8..2a267c92580a8c39979cbd7a5c6e4c515d38cb54 100644 (file)
@@ -4,7 +4,7 @@ Saved searches: [edit]
 
          50 inbox           50 unread           0 empty     
 
 
          50 inbox           50 unread           0 empty     
 
-Search:                                                                     
+Search:                                                                      
 
 [Show all tags]
 
 
 [Show all tags]