This adds a variable which keeps track of the previous saved search results. It is stored as a plist with keys being the saved searches. The result the saved search display function gave last time is passed to the display-function as the the keyword :old argument.
This is useful for display functions that want to keep some state: eg to show that the count has changed, new messages have arrived etc. The function returns a saved search style plist so it can store any information it likes inside this plist. --- emacs/notmuch-hello.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 7075860..e11006b 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -127,6 +127,10 @@ (defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox") :tag "List of Saved Searches" :group 'notmuch-hello) +(defvar notmuch-hello-saved-search-results nil + "Current saved search counts as a plist") +(make-local-variable 'notmuch-hello-saved-search-results) + (defcustom notmuch-hello-recent-searches-max 10 "The number of recent searches to display." :type 'integer @@ -541,11 +545,15 @@ (defun notmuch-hello-query-counts (query-list &rest options) (lambda (elem) (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem)) (display-function (plist-get elem-plist :display-function)) + (old-result (plist-get notmuch-hello-saved-search-results elem)) (result (if display-function (funcall display-function :current elem-plist + :old old-result :option options) (notmuch-hello-batch-message-count elem-plist options)))) + (setq notmuch-hello-saved-search-results + (plist-put notmuch-hello-saved-search-results elem result)) result)) query-list)))) -- 1.7.10.4 _______________________________________________ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch