unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH 3/3] emacs: hide recent searches if `notmuch-hello-recent-searches-max' is zero
Date: Sat, 24 Dec 2011 07:47:16 +0400	[thread overview]
Message-ID: <1324698436-8532-3-git-send-email-dmitry.kurochkin@gmail.com> (raw)
In-Reply-To: <1324698436-8532-1-git-send-email-dmitry.kurochkin@gmail.com>

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

  parent reply	other threads:[~2011-12-24  3:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-24  3:47 [PATCH 1/3] emacs: use a single history for all searches Dmitry Kurochkin
2011-12-24  3:47 ` [PATCH 2/3] emacs: reindent `notmuch-hello' function Dmitry Kurochkin
2011-12-24  3:47 ` Dmitry Kurochkin [this message]
2011-12-24 18:32 ` [PATCH 1/3] emacs: use a single history for all searches Dmitry Kurochkin
2011-12-26 10:58   ` David Edmondson
2011-12-26 11:02     ` Dmitry Kurochkin
2011-12-26 22:02       ` David Edmondson
2011-12-26 22:31         ` Jameson Graef Rollins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1324698436-8532-3-git-send-email-dmitry.kurochkin@gmail.com \
    --to=dmitry.kurochkin@gmail.com \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).