Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 83C7F429E29 for ; Sat, 24 Dec 2011 20:15:54 -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 ENAmbnGZBVhP for ; Sat, 24 Dec 2011 20:15:52 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 226F3429E2E for ; Sat, 24 Dec 2011 20:15:47 -0800 (PST) Received: by werm12 with SMTP id m12so5693068wer.26 for ; Sat, 24 Dec 2011 20:15:45 -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=n+IsRB/Xe6g6IY25Y8DSHJvLZ/G++7iQLdqTuRmynlI=; b=ZxsXSsx75YhXVMSg+1GgZC6sEgmtPL6Rhdvrby1YXAwCH6NGD9c735xTCbs6+wUL+m 26+hUKmEJ+PQmWX63qpRvP0I0DFp4wJ9nWo0h9d+14pAK9cDbQXBsMqWB4LrnCg0CSQe KOR/zYvGlN678HRI93P78VdZgXKWhNfe8N8WM= Received: by 10.216.54.212 with SMTP id i62mr16949118wec.22.1324786545863; Sat, 24 Dec 2011 20:15:45 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id fi6sm38471272wib.2.2011.12.24.20.15.45 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 24 Dec 2011 20:15:45 -0800 (PST) From: Dmitry Kurochkin To: notmuch@notmuchmail.org 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 Message-Id: <1324786495-14221-3-git-send-email-dmitry.kurochkin@gmail.com> X-Mailer: git-send-email 1.7.7.3 In-Reply-To: <1324786495-14221-1-git-send-email-dmitry.kurochkin@gmail.com> References: <1324786495-14221-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: Sun, 25 Dec 2011 04:15:55 -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 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