Re: [PATCH v2 (Draft)] emacs: split async json parser into utility function
authorEthan Glasser-Camp <ethan.glasser.camp@gmail.com>
Sat, 20 Oct 2012 00:30:07 +0000 (20:30 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:49:53 +0000 (09:49 -0800)
6e/1897915cf69eefb0d85ea8f22a9c45acbb9be1 [new file with mode: 0644]

diff --git a/6e/1897915cf69eefb0d85ea8f22a9c45acbb9be1 b/6e/1897915cf69eefb0d85ea8f22a9c45acbb9be1
new file mode 100644 (file)
index 0000000..724e546
--- /dev/null
@@ -0,0 +1,106 @@
+Return-Path: <ethan.glasser.camp@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 DE22C431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Oct 2012 17:30:14 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, 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 CN94arGVON8k for <notmuch@notmuchmail.org>;\r
+       Fri, 19 Oct 2012 17:30:14 -0700 (PDT)\r
+Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com\r
+       [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 432E1431FAE\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Oct 2012 17:30:14 -0700 (PDT)\r
+Received: by mail-vb0-f53.google.com with SMTP id fc21so1179379vbb.26\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Oct 2012 17:30:13 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:in-reply-to:references:user-agent:date\r
+       :message-id:mime-version:content-type;\r
+       bh=l9hgjL7sqwmZ1+FN4CccIU9rT4KcMO2LzZnU21CCJE8=;\r
+       b=wsrm9dDYTFuDOr85Cf6A8FvZWwKhdla1mobjKl+oCBZ13lc7SDtZZOZ7VueRLoxTfB\r
+       cnzY56ALioqIVZoRSwN//4o6nxrRjIHy3wmOs0b4aywnyiOg5ukuIUsahW2tABr9InZo\r
+       QwGUIXdq5naIeXfvp2+DRrSivo0khA/CYiPth2o0P1zZJldZIXY0enBcA6AzfrIYI7do\r
+       abEPXY12H+vlcHqUQWdw81+WD1byiZCmGRvu+mY43ZcM7cj7SOt6SOcDNiVRM2Qnc7kf\r
+       AWFT369LPhVfZwHuD3LhrN5pBdMabZoF0lFUzA9GVN+BrBrM+kaiR1RSm50wDqHK1+Fm\r
+       11sw==\r
+Received: by 10.52.94.225 with SMTP id df1mr2983713vdb.114.1350693013510;\r
+       Fri, 19 Oct 2012 17:30:13 -0700 (PDT)\r
+Received: from smtp.gmail.com (p70-80.acedsl.com. [66.114.70.80])\r
+       by mx.google.com with ESMTPS id g5sm2800448vez.6.2012.10.19.17.30.11\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Fri, 19 Oct 2012 17:30:11 -0700 (PDT)\r
+From: Ethan Glasser-Camp <ethan.glasser.camp@gmail.com>\r
+To: Mark Walters <markwalters1009@gmail.com>,\r
+       Austin Clements <amdragon@MIT.EDU>\r
+Subject: Re: [PATCH v2 (Draft)] emacs: split async json parser into utility\r
+       function\r
+In-Reply-To: <87k3xlyoek.fsf@qmul.ac.uk>\r
+References: <87k3xo85tv.fsf@qmul.ac.uk> <20120730013506.GF8502@mit.edu>\r
+       <87obmxyokt.fsf@qmul.ac.uk> <87k3xlyoek.fsf@qmul.ac.uk>\r
+User-Agent: Notmuch/0.14+45~g6ea9330 (http://notmuchmail.org) Emacs/23.3.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Fri, 19 Oct 2012 20:30:07 -0400\r
+Message-ID: <87ehku6l4g.fsf@betacantrips.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Cc: notmuch@notmuchmail.org\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: Sat, 20 Oct 2012 00:30:15 -0000\r
+\r
+Mark Walters <markwalters1009@gmail.com> writes:\r
+\r
+> Split out the json parser into a utility function.\r
+> ---\r
+>\r
+> Most of this patch is code movement: but I don't see how to arrange the\r
+> patch to show that.\r
+\r
+Hi! This looks like a straightforward patch and if it will make\r
+notmuch-pick more efficient, I'm in favor.\r
+\r
+I tagged this patch moreinfo because David Bremner's suggestions that\r
+you expand on the docstrings for notmuch-json-parser and\r
+notmuch-json-state are good ideas. I'd also propose that you split this\r
+patch into two patches -- one that pulls out the variables and performs\r
+the renames, and the other which breaks out the code into its own\r
+function. This should make the code movement more obvious. I haven't\r
+started full-time work yet so if you would like me to do this, I can ;)\r
+\r
+Based on David Bremner's feedback that it might be a good idea to have a\r
+commit message that explains exactly what is code movement and isn't,\r
+here's my proposal for a commit message.\r
+\r
+Split out the json parser into a utility function.\r
+\r
+This patch breaks out a chunk of notmuch-search-process-filter, with the\r
+following changes:\r
+\r
+- notmuch-search-json-parser becomes notmuch-json-parser.\r
+- notmuch-search-parser-state becomes notmuch-json-state.\r
+\r
+We also rearrange the json-error case but are careful to always call\r
+error-function in the results buffer.\r
+\r
+\r
+\r
+Ethan\r