[PATCH v3] emacs: add invisible dot instead of space at the end of notmuch-hello search box

Pieter Praet pieter at praet.org
Thu Jan 19 15:52:14 PST 2012


From: Dmitry Kurochkin <dmitry.kurochkin at gmail.com>

This makes `show-trailing-whitespace' happy, i.e. it does not mark the
whole search box line as trailing spaces.

Since the dot is invisible, this change makes no visible difference
for `notmuch-hello'.

Edited-by: Pieter Praet <pieter at praet.org> to fix the tests.
---
 emacs/notmuch-hello.el                             |    9 ++++++---
 test/emacs.expected-output/notmuch-hello           |    2 +-
 .../notmuch-hello-no-saved-searches                |    2 +-
 .../emacs.expected-output/notmuch-hello-with-empty |    2 +-
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index bff95ac..55b7877 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -511,9 +511,12 @@ 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 " ")
+	;; Add an invisible dot to make `widget-end-of-line' ignore
+	;; trailing spaces in the search widget field.  A dot is used
+	;; instead of a space to make `show-trailing-whitespace'
+	;; happy, i.e. avoid it marking the whole line as trailing
+	;; spaces.
+	(widget-insert ".")
 	(put-text-property (1- (point)) (point) 'invisible t)
 	(widget-insert "\n")
 
diff --git a/test/emacs.expected-output/notmuch-hello b/test/emacs.expected-output/notmuch-hello
index de57de2..196112e 100644
--- a/test/emacs.expected-output/notmuch-hello
+++ b/test/emacs.expected-output/notmuch-hello
@@ -4,7 +4,7 @@ Saved searches: [edit]
 
 	  52 inbox           52 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 f1fc4d6..f4cfe49 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 52 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 dd8728b..a860a72 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]
 
 	  52 inbox           52 unread           0 empty     
 
-Search:                                                                      
+Search:                                                                     .
 
 [Show all tags]
 
-- 
1.7.8.1



More information about the notmuch mailing list