--- /dev/null
+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 84831431FD5\r
+ for <notmuch@notmuchmail.org>; Sat, 5 Apr 2014 22:45:20 -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 CfXx6GGjWlwg for <notmuch@notmuchmail.org>;\r
+ Sat, 5 Apr 2014 22:45:16 -0700 (PDT)\r
+Received: from mail-wg0-f44.google.com (mail-wg0-f44.google.com\r
+ [74.125.82.44]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ E1C75431FAF for <notmuch@notmuchmail.org>; Sat, 5 Apr 2014 22:45:10 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f44.google.com with SMTP id m15so5331842wgh.27\r
+ for <notmuch@notmuchmail.org>; Sat, 05 Apr 2014 22:45:09 -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=0ixTu9gmiCezx2AQ7mHuWucjQ51oJw9p/jAdvg824c0=;\r
+ b=MS+0+o+0UbPXP/EjNIajx9Qmg+efYc3fikkLFS0X1gkFDjaL4xcn/lP0FJiZcuZbfZ\r
+ bEcV6mu8FyqfkdoCXxLetsszqaX3duWQBA2GkwE3PiKTSBxSvgGfgS9u/jkTfqQkNGKi\r
+ plpHPiWTklK3Xn048VC/13QEYhUktRJFHqRqo7/+v0mPcrf/8cngpIdkzY/s+UbnsMj0\r
+ +24F9uT0+x3WCazaziFGGUt6nsyA/GS4aZLCKTZjU6p+RqA22TcHvAXYt1AmPBqTn9fx\r
+ OW2E18Z7zfFQ+nXRVz0vWf50/7/0IVsd2VChjn9vVlOAN296jZkxmZAWk0lSyeh/r0Ia\r
+ /vLw==\r
+X-Received: by 10.180.101.134 with SMTP id fg6mr16465233wib.6.1396763109831;\r
+ Sat, 05 Apr 2014 22:45:09 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id u6sm15187135wif.6.2014.04.05.22.45.08\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sat, 05 Apr 2014 22:45:09 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org,\r
+ amdragon@MIT.EDU\r
+Subject: [PATCH v2 4/5] emacs: hello: switch notmuch-hello-insert-buttons to\r
+ plists\r
+Date: Sun, 6 Apr 2014 06:44:48 +0100\r
+Message-Id: <1396763089-32452-5-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1396763089-32452-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1396763089-32452-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, 06 Apr 2014 05:45:20 -0000\r
+\r
+Switching notmuch-hello-insert-buttons to plists means we can easily\r
+pass extra options through to the buttons.\r
+---\r
+ emacs/notmuch-hello.el | 35 ++++++++++++++++++++---------------\r
+ 1 file changed, 20 insertions(+), 15 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index 30f26db..f440352 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -424,7 +424,9 @@ (defun notmuch-hello-query-counts (query-list &rest options)\r
+ these is a plist but other options are available for backwards\r
+ compatibility: see `notmuch-saved-searches' for details.\r
+ \r
+-The result is the list of elements of the form (NAME QUERY COUNT).\r
++The result is a list of plists each of which includes the\r
++properties :name NAME, :query QUERY and :count COUNT, together\r
++with any properties in the original saved-search.\r
+ \r
+ The values :show-empty-searches, :filter and :filter-count from\r
+ options will be handled as specified for\r
+@@ -454,23 +456,26 @@ (defun notmuch-hello-query-counts (query-list &rest options)\r
+ #'identity\r
+ (mapcar\r
+ (lambda (elem)\r
+- (let ((name (notmuch-saved-search-get elem :name))\r
+- (search-query (notmuch-saved-search-get elem :query))\r
+- (message-count (prog1 (read (current-buffer))\r
++ (let* ((elem-plist (notmuch-hello-saved-search-to-plist elem))\r
++ (search-query (plist-get elem-plist :query))\r
++ (filtered-query (notmuch-hello-filtered-query\r
++ search-query (plist-get options :filter)))\r
++ (message-count (prog1 (read (current-buffer))\r
+ (forward-line 1))))\r
+- (and (or (plist-get options :show-empty-searches) (> message-count 0))\r
+- (list name (notmuch-hello-filtered-query\r
+- search-query (plist-get options :filter))\r
+- message-count))))\r
++ (when (and filtered-query (or (plist-get options :show-empty-searches) (> message-count 0)))\r
++ (setq elem-plist (plist-put elem-plist :query filtered-query))\r
++ (plist-put elem-plist :count message-count))))\r
+ query-list))))\r
+ \r
+ (defun notmuch-hello-insert-buttons (searches)\r
+ "Insert buttons for SEARCHES.\r
+ \r
+-SEARCHES must be a list containing lists of the form (NAME QUERY COUNT), where\r
+-QUERY is the query to start when the button for the corresponding entry is\r
+-activated. COUNT should be the number of messages matching the query.\r
+-Such a list can be computed with `notmuch-hello-query-counts'."\r
++SEARCHES must be a list of plists each of which should contain at\r
++least the properties :name NAME :query QUERY and :count COUNT,\r
++where QUERY is the query to start when the button for the\r
++corresponding entry is activated, and COUNT should be the number\r
++of messages matching the query. Such a plist can be computed\r
++with `notmuch-hello-query-counts'."\r
+ (let* ((widest (notmuch-hello-longest-label searches))\r
+ (tags-and-width (notmuch-hello-tags-per-line widest))\r
+ (tags-per-line (car tags-and-width))\r
+@@ -488,9 +493,9 @@ (defun notmuch-hello-insert-buttons (searches)\r
+ (when elem\r
+ (if (> column-indent 0)\r
+ (widget-insert (make-string column-indent ? )))\r
+- (let* ((name (first elem))\r
+- (query (second elem))\r
+- (msg-count (third elem)))\r
++ (let* ((name (plist-get elem :name))\r
++ (query (plist-get elem :query))\r
++ (msg-count (plist-get elem :count)))\r
+ (widget-insert (format "%8s "\r
+ (notmuch-hello-nice-number msg-count)))\r
+ (widget-create 'push-button\r
+-- \r
+1.7.10.4\r
+\r