[PATCH 3/3] emacs: hide recent searches if `notmuch-hello-recent-searches-max' is zero

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Fri Dec 23 19:47:16 PST 2011


---
 emacs/notmuch-hello.el |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 0922821..821ef22 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -36,7 +36,10 @@
   "Variable to store history for notmuch queries.")
 
 (defcustom notmuch-hello-recent-searches-max 10
-  "The number of recent searches to display."
+  "The number of recent searches to display.
+
+Recent searches section is not shown if
+`notmuch-hello-recent-searches-max' is set to 0."
   :type 'integer
   :group 'notmuch)
 
@@ -161,6 +164,10 @@ International Bureau of Weights and Measures."
   (let ((history-delete-duplicates t))
     (add-to-history 'notmuch-query-history search)))
 
+(defun notmuch-hello-show-recent-searches ()
+  (and (> notmuch-hello-recent-searches-max 0)
+       notmuch-query-history))
+
 (defun notmuch-hello-nice-number (n)
   (let (result)
     (while (> n 0)
@@ -509,7 +516,7 @@ Complete list of currently available key bindings:
 	(put-text-property (1- (point)) (point) 'invisible t)
 	(widget-insert "\n")
 
-	(when notmuch-query-history
+	(when (notmuch-hello-show-recent-searches)
 	  (widget-insert "\nRecent searches: ")
 	  (widget-create 'push-button
 			 :notify (lambda (&rest ignore)
@@ -576,7 +583,7 @@ Complete list of currently available key bindings:
       (let ((start (point)))
 	(widget-insert "\n\n")
 	(widget-insert "Type a search query and hit RET to view matching threads.\n")
-	(when notmuch-query-history
+	(when (notmuch-hello-show-recent-searches)
 	  (widget-insert "Hit RET to re-submit a previous search. Edit it first if you like.\n")
 	  (widget-insert "Save recent searches with the `save' button.\n"))
 	(when notmuch-saved-searches
-- 
1.7.7.3



More information about the notmuch mailing list