]> git.notmuchmail.org Git - notmuch/commitdiff
emacs: put the last search on top of recent searches in notmuch-hello
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Thu, 22 Dec 2011 00:23:50 +0000 (04:23 +0400)
committerDavid Bremner <bremner@debian.org>
Thu, 22 Dec 2011 11:41:02 +0000 (07:41 -0400)
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

index 2f7e17dc0aed79bd6c614768cd35bfcd57ef2fd8..333d4c1ea633749cabb7dcf0e31f78241b1eadd2 100644 (file)
@@ -157,8 +157,9 @@ International Bureau of Weights and Measures."
 (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))))