aboutsummaryrefslogtreecommitdiff
path: root/emacs/notmuch-hello.el
diff options
context:
space:
mode:
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>2011-12-22 04:23:50 +0400
committerDavid Bremner <bremner@debian.org>2011-12-22 07:41:02 -0400
commit49af79cd2a3be66e482039f1ef05cf909144230e (patch)
treebc707de9241e3ced9896cafbb25763f3cd0e58c4 /emacs/notmuch-hello.el
parent9a0b61da56ede4d0ff79a064d92d8c1a16cf636b (diff)
emacs: put the last search on top of recent searches in notmuch-hello
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.
Diffstat (limited to 'emacs/notmuch-hello.el')
-rw-r--r--emacs/notmuch-hello.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 2f7e17d..333d4c1 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -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))))