--- /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 C5E8D431FCF\r
+ for <notmuch@notmuchmail.org>; Sat, 5 Apr 2014 22:45:12 -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 xmGrUZpI4jbd for <notmuch@notmuchmail.org>;\r
+ Sat, 5 Apr 2014 22:45:07 -0700 (PDT)\r
+Received: from mail-we0-f175.google.com (mail-we0-f175.google.com\r
+ [74.125.82.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 0CACC431FB6\r
+ for <notmuch@notmuchmail.org>; Sat, 5 Apr 2014 22:45:06 -0700 (PDT)\r
+Received: by mail-we0-f175.google.com with SMTP id q58so5179777wes.6\r
+ for <notmuch@notmuchmail.org>; Sat, 05 Apr 2014 22:45:04 -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=geHyb0nfA8DIJQxfbcGsSKgqAyKyYhZxIjOtq2TgKuI=;\r
+ b=WPLSOsyxO8vCXBy3utaOqdFitNxlK4Gt1Ok9SvFnrn0VQePGgJHDc/+CNEcCxehE+k\r
+ MqAVlEaeY4BNa77dp29jazmrK99Z/eaR0Rz4HbC+6L5Dd836cFwrVlOM1T46aWnYjwyF\r
+ lFb2WWdsNGSJuV8H3poDQGwKkbd7wpRS9gJ9vMtoeDB4Qa778WyXPO70ymKJpzRvusoT\r
+ 3rcKZ0Y9WH9N4l7DxcVZyCxl6g1UGP1yW4yJZRnP3yoEclkYdknNBmN+dlbmEyDVUR/W\r
+ DJsPAQTgQjgGgm/PNzJFuy6Gzr2IZZFmdj0aVuhJlA/xUUhQFWz0AKs/NBpdIPTngd4w\r
+ 2bXw==\r
+X-Received: by 10.180.10.164 with SMTP id j4mr4106453wib.51.1396763104681;\r
+ Sat, 05 Apr 2014 22:45:04 -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\r
+ er4sm20118660wjd.38.2014.04.05.22.45.03 for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sat, 05 Apr 2014 22:45:04 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org,\r
+ amdragon@MIT.EDU\r
+Subject: [PATCH v2 1/5] emacs: hello: add helper functions for saved-searches\r
+Date: Sun, 6 Apr 2014 06:44:45 +0100\r
+Message-Id: <1396763089-32452-2-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:13 -0000\r
+\r
+Add helper functions to for saved searches to ease the transition to\r
+the new plist form while maintaining backwards compatibility. They\r
+will be used in the next patch.\r
+---\r
+ emacs/notmuch-hello.el | 38 ++++++++++++++++++++++++++++++++++++++\r
+ 1 file changed, 38 insertions(+)\r
+\r
+diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
+index e325cd3..f81ec27 100644\r
+--- a/emacs/notmuch-hello.el\r
++++ b/emacs/notmuch-hello.el\r
+@@ -269,6 +269,44 @@ (defun notmuch-hello-search (&optional search)\r
+ (add-to-history 'notmuch-search-history search)))\r
+ (notmuch-search search notmuch-search-oldest-first))\r
+ \r
++(defun notmuch-saved-search-get (saved-search field)\r
++ "Get FIELD from SAVED-SEARCH.\r
++\r
++If SAVED-SEARCH is a plist, this is just `plist-get', but for\r
++backwards compatibility, this also deals with the two other\r
++possible formats for SAVED-SEARCH: cons cells (NAME . QUERY) and\r
++lists (NAME QUERY COUNT-QUERY)."\r
++ (cond\r
++ ((keywordp (car saved-search))\r
++ (plist-get saved-search field))\r
++ ;; It is not a plist so it is an old-style entry.\r
++ ((consp (cdr saved-search)) ;; It is a list (NAME QUERY COUNT-QUERY)\r
++ (case field\r
++ (:name (first saved-search))\r
++ (:query (second saved-search))\r
++ (:count-query (third saved-search))\r
++ (t nil)))\r
++ (t ;; It is a cons-cell (NAME . QUERY)\r
++ (case field\r
++ (:name (car saved-search))\r
++ (:query (cdr saved-search))\r
++ (t nil)))))\r
++\r
++(defun notmuch-hello-saved-search-to-plist (saved-search)\r
++ "Return a copy of SAVED-SEARCH in plist form.\r
++\r
++If saved search is a plist then just return a copy. In other\r
++cases, for backwards compatability, convert to plist form and\r
++return that."\r
++ (if (keywordp (car saved-search))\r
++ (copy-seq saved-search)\r
++ (let ((fields (list :name :query :count-query))\r
++ plist-search)\r
++ (dolist (field fields plist-search)\r
++ (let ((string (notmuch-saved-search-get saved-search field)))\r
++ (when string\r
++ (setq plist-search (append plist-search (list field string)))))))))\r
++\r
+ (defun notmuch-hello-add-saved-search (widget)\r
+ (interactive)\r
+ (let ((search (widget-value\r
+-- \r
+1.7.10.4\r
+\r