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

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

Date: Sun, 25 Dec 2011 08:14:54 +0400

To: notmuch@notmuchmail.org

Cc:

From: Dmitry Kurochkin


---
 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 fa33500..6015af4 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -30,7 +30,10 @@
 (declare-function notmuch-poll "notmuch" ())
 
 (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)
 
@@ -151,6 +154,10 @@ International Bureau of Weights and Measures."
 (defvar notmuch-hello-url "http://notmuchmail.org"
   "The `notmuch' web site.")
 
+(defun notmuch-hello-show-recent-searches ()
+  (and (> notmuch-hello-recent-searches-max 0)
+       notmuch-search-history))
+
 (defun notmuch-hello-nice-number (n)
   (let (result)
     (while (> n 0)
@@ -482,7 +489,7 @@ Complete list of currently available key bindings:
 		       " Search! ")
 	(widget-insert "\n")
 
-	(when notmuch-search-history
+	(when (notmuch-hello-show-recent-searches)
 	  (widget-insert "\nRecent searches: ")
 	  (widget-create 'push-button
 			 :notify (lambda (&rest ignore)
@@ -549,7 +556,7 @@ Complete list of currently available key bindings:
       (let ((start (point)))
 	(widget-insert "\n\n")
 	(widget-insert "Use the `search' button or hit `s' to enter search query.\n")
-	(when notmuch-search-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


Thread: