From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4FBE5429E43 for ; Fri, 23 Dec 2011 19:48:10 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wqkVKZmOZ8LP for ; Fri, 23 Dec 2011 19:48:09 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id B6C34431FB6 for ; Fri, 23 Dec 2011 19:48:04 -0800 (PST) Received: by mail-ww0-f45.google.com with SMTP id ds13so14931710wgb.2 for ; Fri, 23 Dec 2011 19:48:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:x-mailer:in-reply-to:references; bh=a05SJZGqmsLLdm/QQNKFzpxjhenCytiTNHNL3WSbAOo=; b=RrifwtnZr4luHKHDqJl//SXRy+vlizqbPWtd6LnzOPvcOJD9wOOcZTxpbcSMMHhGwe tFWps+APh1UygeeVMtnd1LDxuWe3NOHaYPRizepb8oADpKJHB1hVKGDBSyJ6RiBHkvpT qEdXNYiTQop4rtB/MoCsT3IEiGiZj7+lTs7Vs= Received: by 10.227.206.129 with SMTP id fu1mr16788459wbb.22.1324698484335; Fri, 23 Dec 2011 19:48:04 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id u5sm15923111wbm.2.2011.12.23.19.48.03 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 23 Dec 2011 19:48:04 -0800 (PST) From: Dmitry Kurochkin 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 Message-Id: <1324698436-8532-3-git-send-email-dmitry.kurochkin@gmail.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1324698436-8532-1-git-send-email-dmitry.kurochkin@gmail.com> References: <1324698436-8532-1-git-send-email-dmitry.kurochkin@gmail.com> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Dec 2011 03:48:10 -0000 --- 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