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 D9090429E25 for ; Wed, 21 Dec 2011 16:24:36 -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 cduYMH84CGha for ; Wed, 21 Dec 2011 16:24:36 -0800 (PST) Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 1F6D0431FD0 for ; Wed, 21 Dec 2011 16:24:35 -0800 (PST) Received: by wgbdt12 with SMTP id dt12so10472009wgb.2 for ; Wed, 21 Dec 2011 16:24:35 -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; bh=6rQtYGIAPY9uv3ExTZL0WMesC63XEPNcuPiXkNYog2w=; b=hXQi0OvrjYJNFc6kBr8LwZQ4gwaWwKMbFqZpScXX2LA9Tq3P6oLfSUMEmaH2IrXfg9 mu/G1iL8OG+lm0SL/o8NUhZt5mE+/kJ8Zq7WxkgHDH7C0dvEQst1lwlBzg/WBdRRLEqX L+oH4nx3noMAdONbOk/0lHJBxA8CHAD4Hp1xY= Received: by 10.180.94.97 with SMTP id db1mr18233138wib.16.1324513474935; Wed, 21 Dec 2011 16:24:34 -0800 (PST) Received: from localhost ([91.144.186.21]) by mx.google.com with ESMTPS id eg7sm17696723wib.8.2011.12.21.16.24.33 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Dec 2011 16:24:34 -0800 (PST) From: Dmitry Kurochkin To: notmuch@notmuchmail.org Subject: [PATCH] emacs: put the last search on top of recent searches in notmuch-hello Date: Thu, 22 Dec 2011 04:23:50 +0400 Message-Id: <1324513430-15650-1-git-send-email-dmitry.kurochkin@gmail.com> X-Mailer: git-send-email 1.7.7.3 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: Thu, 22 Dec 2011 00:24:37 -0000 Notmuch-hello stores a list of recent searches. Before the change, if a search from this list is repeated, the recent search list is not changed. The patch makes repeated recent searches move to the head of the list. I.e. the last search is always on top of the recent search list, which is what one would expect from a history list. --- emacs/notmuch-hello.el | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index f892ff7..2fb0cfc 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -154,8 +154,9 @@ Typically \",\" in the US and UK and \".\" in Europe." (defvar notmuch-hello-recent-searches nil) (defun notmuch-hello-remember-search (search) - (if (not (member search notmuch-hello-recent-searches)) - (push search notmuch-hello-recent-searches)) + (setq notmuch-hello-recent-searches + (delete search notmuch-hello-recent-searches)) + (push search notmuch-hello-recent-searches) (if (> (length notmuch-hello-recent-searches) notmuch-recent-searches-max) (setq notmuch-hello-recent-searches (butlast notmuch-hello-recent-searches)))) -- 1.7.7.3