[PATCH 3/7] emacs: hello: store previous saved-search results
authorMark Walters <markwalters1009@gmail.com>
Sun, 11 May 2014 08:34:38 +0000 (09:34 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 18:02:40 +0000 (10:02 -0800)
31/ab5aeaa3dbd40d876e71b80382917d8f469b78 [new file with mode: 0644]

diff --git a/31/ab5aeaa3dbd40d876e71b80382917d8f469b78 b/31/ab5aeaa3dbd40d876e71b80382917d8f469b78
new file mode 100644 (file)
index 0000000..ddf86fa
--- /dev/null
@@ -0,0 +1,110 @@
+Return-Path: <markwalters1009@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 045A2431FC0\r
+       for <notmuch@notmuchmail.org>; Sun, 11 May 2014 01:35:03 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 8Ba8lDYgDcmq for <notmuch@notmuchmail.org>;\r
+       Sun, 11 May 2014 01:34:57 -0700 (PDT)\r
+Received: from mail-we0-f176.google.com (mail-we0-f176.google.com\r
+       [74.125.82.176]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 06B83431FC3\r
+       for <notmuch@notmuchmail.org>; Sun, 11 May 2014 01:34:53 -0700 (PDT)\r
+Received: by mail-we0-f176.google.com with SMTP id q59so5485305wes.7\r
+       for <notmuch@notmuchmail.org>; Sun, 11 May 2014 01:34:52 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+       bh=D0/2AqwSy12chsRku2rIQ6KCll+oD4VHK0vyVbj9Cv8=;\r
+       b=K01CM7yf1K+96sheCj1P8eWfhOEVqKEO3QD2FLexeCexK5l0p2vHO19kbfiPkGAafA\r
+       Gk42Ujr+UMwhurY6ZCEuHIwY7m/7TdpycLV3iyFObWgifEmszNBTLjOk+DfvfkE+PtZP\r
+       pGJ1DvfF/ekaMXv9d0ImEaKaXDHJSTmBPfo3KHJ1f6pxswVgWVe8k4M1p88wiVK04VTZ\r
+       HGRQbCCfWz7xbkU3uaRa6MdPyKKADeo+tP5BgggfjCESj75rcZUozTcDRQPv33JZHKWO\r
+       KkLGexrlW7YRWqBc3maPc+WlUQ2021MrnvUnjQG1EUKrHVODIRzkMx6bWdroFQ2HNlS5\r
+       yMNQ==\r
+X-Received: by 10.180.36.212 with SMTP id s20mr10650438wij.18.1399797292931;\r
+       Sun, 11 May 2014 01:34:52 -0700 (PDT)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+       by mx.google.com with ESMTPSA id\r
+       gr2sm12751610wjc.12.2014.05.11.01.34.51 for <multiple recipients>\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Sun, 11 May 2014 01:34:52 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 3/7] emacs: hello: store previous saved-search results\r
+Date: Sun, 11 May 2014 09:34:38 +0100\r
+Message-Id: <1399797282-20389-4-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1399797282-20389-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1399797282-20389-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sun, 11 May 2014 08:35:03 -0000\r
+\r
+This adds a variable which keeps track of the previous saved search\r
+results. It is stored as a plist with keys being the saved\r
+searches. The result the saved search display function gave last time\r
+is passed to the display-function as the the keyword :old argument.\r
+\r
+This is useful for display functions that want to keep some state: eg\r
+to show that the count has changed, new messages have arrived etc. The\r
+function returns a saved search style plist so it can store any\r
+information it likes inside this plist.\r
+---\r
+ emacs/notmuch-hello.el |    8 ++++++++\r
+ 1 file changed, 8 insertions(+)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 7075860..e11006b 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -127,6 +127,10 @@ (defcustom notmuch-saved-searches '((:name "inbox" :query "tag:inbox")\r
+   :tag "List of Saved Searches"\r
+   :group 'notmuch-hello)\r
\r
++(defvar notmuch-hello-saved-search-results nil\r
++  "Current saved search counts as a plist")\r
++(make-local-variable 'notmuch-hello-saved-search-results)\r
++\r
+ (defcustom notmuch-hello-recent-searches-max 10\r
+   "The number of recent searches to display."\r
+   :type 'integer\r
+@@ -541,11 +545,15 @@ (defun notmuch-hello-query-counts (query-list &rest options)\r
+       (lambda (elem)\r
+       (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem))\r
+              (display-function (plist-get elem-plist :display-function))\r
++             (old-result (plist-get notmuch-hello-saved-search-results elem))\r
+              (result (if display-function\r
+                           (funcall display-function\r
+                                    :current elem-plist\r
++                                   :old old-result\r
+                                    :option options)\r
+                         (notmuch-hello-batch-message-count elem-plist options))))\r
++        (setq notmuch-hello-saved-search-results\r
++              (plist-put notmuch-hello-saved-search-results elem result))\r
+         result))\r
+       query-list))))\r
\r
+-- \r
+1.7.10.4\r
+\r