--- /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 9236F431FCF\r
+ for <notmuch@notmuchmail.org>; Sun, 28 Oct 2012 06:37:17 -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 lNl8o1TE9-e9 for <notmuch@notmuchmail.org>;\r
+ Sun, 28 Oct 2012 06:37:17 -0700 (PDT)\r
+Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com\r
+ [209.85.212.173]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id D3BFA431FAF\r
+ for <notmuch@notmuchmail.org>; Sun, 28 Oct 2012 06:37:16 -0700 (PDT)\r
+Received: by mail-wi0-f173.google.com with SMTP id hm4so1231150wib.2\r
+ for <notmuch@notmuchmail.org>; Sun, 28 Oct 2012 06:37:15 -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:x-mailer;\r
+ bh=VAp1I7ti0Vnq+/HbGWGGOkWZ9e9YLHtXkonTs3C2i6E=;\r
+ b=Ak2CNrDnqGH67O4f6SAYTzPlvENWH/z6GlwYQatvxXpR3rRITYAzGcwlBNjQGr3jvB\r
+ dWXRUU5OwFKcdKKRMvRrUKA2AyQQbo0HLkBlAj+ahvS2ARafXEg3ke0JpshJMWAIuiqR\r
+ hhD2Lj3TOtIIOm54KXwYP0OSET/Rh2jGy8Lpnh4HwoKHm8mH1tpHSwwoQ+nwsN379aOC\r
+ 6Lt5tS9tFt233/RHNz9f0AsjLwDj8ihiq0kxrcSevqPuJ78ahfyCxD5jq8nxGOb6Ea2q\r
+ sqQWT2p5yNxKYUxgIjXm/tzPtEDRvdnTDMAjsmEl22S86M0n18A3ZCikMmyfo4vJAZVu\r
+ GgiA==\r
+Received: by 10.180.8.134 with SMTP id r6mr11475074wia.18.1351431435519;\r
+ Sun, 28 Oct 2012 06:37:15 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPS id bf6sm3156751wib.3.2012.10.28.06.37.13\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sun, 28 Oct 2012 06:37:14 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] contrib: pick: use async parser from lib\r
+Date: Sun, 28 Oct 2012 13:37:10 +0000\r
+Message-Id: <1351431430-5308-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\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, 28 Oct 2012 13:37:17 -0000\r
+\r
+This moves notmuch-pick to use the newly split out async json parser\r
+from notmuch-lib.el. \r
+\r
+---\r
+\r
+I hadn't expected the split out json parser to go in so quickly: this\r
+moves notmuch-pick to use the new function. \r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+ contrib/notmuch-pick/notmuch-pick.el | 52 +++------------------------------\r
+ 1 files changed, 5 insertions(+), 47 deletions(-)\r
+\r
+diff --git a/contrib/notmuch-pick/notmuch-pick.el b/contrib/notmuch-pick/notmuch-pick.el\r
+index be6a91a..15ac5e8 100644\r
+--- a/contrib/notmuch-pick/notmuch-pick.el\r
++++ b/contrib/notmuch-pick/notmuch-pick.el\r
+@@ -435,7 +435,7 @@ Does NOT change the database."\r
+ (unless (notmuch-pick-get-match)\r
+ (notmuch-pick-next-matching-message))\r
+ (while (and (not (notmuch-pick-get-match))\r
+- (not (eq notmuch-pick-process-state 'end)))\r
++ (get-buffer-process (current-buffer)))\r
+ (message "waiting for message")\r
+ (sit-for 0.1)\r
+ (goto-char (point-min))\r
+@@ -733,9 +733,6 @@ Complete list of currently available key bindings:\r
+ (insert "\n")))\r
+ \r
+ \r
+-(defvar notmuch-pick-json-parser nil\r
+- "Incremental JSON parser for the search process filter.")\r
+-\r
+ (defun notmuch-pick-process-filter (proc string)\r
+ "Process and filter the output of \"notmuch show\" (for pick)"\r
+ (let ((results-buf (process-buffer proc))\r
+@@ -748,46 +745,10 @@ Complete list of currently available key bindings:\r
+ ;; Insert new data\r
+ (save-excursion\r
+ (goto-char (point-max))\r
+- (insert string)))\r
+- (with-current-buffer results-buf\r
+- (save-excursion\r
+- (goto-char (point-max))\r
+- (while (not done)\r
+- (condition-case nil\r
+- (case notmuch-pick-process-state\r
+- ((begin)\r
+- ;; Enter the results list\r
+- (if (eq (notmuch-json-begin-compound\r
+- notmuch-pick-json-parser) 'retry)\r
+- (setq done t)\r
+- (setq notmuch-pick-process-state 'result)))\r
+- ((result)\r
+- ;; Parse a result\r
+- (let ((result (notmuch-json-read notmuch-pick-json-parser)))\r
+- (case result\r
+- ((retry) (setq done t))\r
+- ((end) (setq notmuch-pick-process-state 'end))\r
+- (otherwise (notmuch-pick-insert-forest-thread result)))))\r
+- ((end)\r
+- ;; Any trailing data is unexpected\r
+- (with-current-buffer parse-buf\r
+- (skip-chars-forward " \t\r\n")\r
+- (if (eobp)\r
+- (setq done t)\r
+- (signal 'json-error nil)))))\r
+- (json-error\r
+- ;; Do our best to resynchronize and ensure forward\r
+- ;; progress\r
+- (notmuch-pick-show-error\r
+- "%s"\r
+- (with-current-buffer parse-buf\r
+- (let ((bad (buffer-substring (line-beginning-position)\r
+- (line-end-position))))\r
+- (forward-line)\r
+- bad))))))\r
+- ;; Clear out what we've parsed\r
+- (with-current-buffer parse-buf\r
+- (delete-region (point-min) (point))))))))\r
++ (insert string))\r
++ (notmuch-json-parse-partial-list 'notmuch-pick-insert-forest-thread\r
++ 'notmuch-pick-show-error\r
++ results-buf)))))\r
+ \r
+ (defun notmuch-pick-worker (basic-query &optional query-context buffer)\r
+ (interactive)\r
+@@ -815,9 +776,6 @@ Complete list of currently available key bindings:\r
+ ;; This buffer will be killed by the sentinel, which\r
+ ;; should be called no matter how the process dies.\r
+ (parse-buf (generate-new-buffer " *notmuch pick parse*")))\r
+- (set (make-local-variable 'notmuch-pick-process-state) 'begin)\r
+- (set (make-local-variable 'notmuch-pick-json-parser)\r
+- (notmuch-json-create-parser parse-buf))\r
+ (process-put proc 'parse-buf parse-buf)\r
+ (set-process-sentinel proc 'notmuch-pick-process-sentinel)\r
+ (set-process-filter proc 'notmuch-pick-process-filter)\r
+-- \r
+1.7.9.1\r
+\r