From f225ee59ebdbd6961a0665f7e912825fbcc691d1 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 6 Apr 2014 06:44:49 +0100 Subject: emacs: Add a sort-order option to saved-searches This adds a sort-order option to saved-searches, stores it in the saved-search buttons (widgets), and uses the stored value when the button is pressed. Storing the sort-order in the widget was suggested by Jani in id:4c3876274126985683e888641b29cf18142a5eb8.1391771337.git.jani@nikula.org. --- emacs/notmuch-hello.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'emacs/notmuch-hello.el') diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index e2b6ce4f..4900a242 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -363,7 +363,8 @@ diagonal." (defun notmuch-hello-widget-search (widget &rest ignore) (notmuch-search (widget-get widget :notmuch-search-terms) - notmuch-search-oldest-first)) + (widget-get widget + :notmuch-search-oldest-first))) (defun notmuch-saved-search-count (search) (car (process-lines notmuch-command "count" search))) @@ -495,12 +496,17 @@ with `notmuch-hello-query-counts'." (widget-insert (make-string column-indent ? ))) (let* ((name (plist-get elem :name)) (query (plist-get elem :query)) + (oldest-first (case (plist-get elem :sort-order) + (newest-first nil) + (oldest-first t) + (otherwise notmuch-search-oldest-first))) (msg-count (plist-get elem :count))) (widget-insert (format "%8s " (notmuch-hello-nice-number msg-count))) (widget-create 'push-button :notify #'notmuch-hello-widget-search :notmuch-search-terms query + :notmuch-search-oldest-first oldest-first name) (setq column-indent (1+ (max 0 (- column-width (length name))))))) -- cgit v1.2.3