From 5894a4e7ef86e2bc38778ec3d8bc15a0ec2f2e81 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Wed, 24 Oct 2012 01:13:22 +0100 Subject: [PATCH] [PATCH v3 3/3] emacs: Code movement for the incremental JSON parser. --- 9f/4399903136f2748610622eb7efbd1bb2f1b22e | 126 ++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 9f/4399903136f2748610622eb7efbd1bb2f1b22e diff --git a/9f/4399903136f2748610622eb7efbd1bb2f1b22e b/9f/4399903136f2748610622eb7efbd1bb2f1b22e new file mode 100644 index 000000000..d83b149d4 --- /dev/null +++ b/9f/4399903136f2748610622eb7efbd1bb2f1b22e @@ -0,0 +1,126 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id BFFEA431FC9 + for ; Tue, 23 Oct 2012 17:13:52 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0.201 +X-Spam-Level: +X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, + RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id vEjqmUUP9CHL for ; + Tue, 23 Oct 2012 17:13:52 -0700 (PDT) +Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com + [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B1FB1431FC0 + for ; Tue, 23 Oct 2012 17:13:51 -0700 (PDT) +Received: by mail-wi0-f179.google.com with SMTP id hq7so3333696wib.2 + for ; Tue, 23 Oct 2012 17:13:50 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=QemQXsgPh/2jIhYvWU40KTSnI0ZIdDYy8ZjGkLyZ6vY=; + b=cP6B6uBmST06m3/urN/MAUr46bU0UfMZtK4WfKqZve2fnYftS7k6YWkQDVyuKYO3gJ + 8l8XisPicWHQC+pK7k4RE/5NYQbAAth0UBcVXjSEGhAPvXKZPdDtvSV6NNHNAmUpvIKP + UgcikvQ+tXgOdctGtaR/G3UTJCB0sYFFykIfI/apIy0VMIs4loIQc5oFTKghE3FIHnxO + Y97EL43ADFk6OWAyTmdZWGmOJtIV7QqluLWuuIJrkKjcuJZ6q+/0j9NquUgxlX2HAtCE + HhTftckZDvTLelsgpawLgJmVLI2QPV+0s5HudA89LXc+ZhRvzoJPkdEbH+pQ6aRV8UGb + tDnQ== +Received: by 10.216.203.1 with SMTP id e1mr8827224weo.103.1351037630621; + Tue, 23 Oct 2012 17:13:50 -0700 (PDT) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPS id f1sm1423272wiy.2.2012.10.23.17.13.49 + (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 23 Oct 2012 17:13:49 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v3 3/3] emacs: Code movement for the incremental JSON parser. +Date: Wed, 24 Oct 2012 01:13:22 +0100 +Message-Id: <1351037602-11157-4-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1351037602-11157-1-git-send-email-markwalters1009@gmail.com> +References: <1351037602-11157-1-git-send-email-markwalters1009@gmail.com> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 24 Oct 2012 00:13:53 -0000 + +This just moves the notmuch-search-process-filter after the newly +split out incremental json parser. I think this removes a warning in +some versions of emacs. + +There should be no functional change. +--- + emacs/notmuch.el | 34 +++++++++++++++++----------------- + 1 files changed, 17 insertions(+), 17 deletions(-) + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index 7e5d052..ab253b7 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -818,23 +818,6 @@ non-authors is found, assume that all of the authors match." + (defvar notmuch-json-parser nil + "Internal Incremental JSON parser Object.") + +-(defun notmuch-search-process-filter (proc string) +- "Process and filter the output of \"notmuch search\"" +- (let ((results-buf (process-buffer proc)) +- (parse-buf (process-get proc 'parse-buf)) +- (inhibit-read-only t) +- done) +- (if (not (buffer-live-p results-buf)) +- (delete-process proc) +- (with-current-buffer parse-buf +- ;; Insert new data +- (save-excursion +- (goto-char (point-max)) +- (insert string)) +- (notmuch-json-parse-partial-list 'notmuch-search-show-result +- 'notmuch-search-show-error +- results-buf))))) +- + (defun notmuch-json-parse-partial-list (result-function error-function results-buf) + "Parse a partial JSON list from current buffer. + +@@ -884,6 +867,23 @@ RESULT-BUFFER to any input that was skipped." + ;; Clear out what we've parsed + (delete-region (point-min) (point)))) + ++(defun notmuch-search-process-filter (proc string) ++ "Process and filter the output of \"notmuch search\"" ++ (let ((results-buf (process-buffer proc)) ++ (parse-buf (process-get proc 'parse-buf)) ++ (inhibit-read-only t) ++ done) ++ (if (not (buffer-live-p results-buf)) ++ (delete-process proc) ++ (with-current-buffer parse-buf ++ ;; Insert new data ++ (save-excursion ++ (goto-char (point-max)) ++ (insert string)) ++ (notmuch-json-parse-partial-list 'notmuch-search-show-result ++ 'notmuch-search-show-error ++ results-buf))))) ++ + (defun notmuch-search-tag-all (&optional tag-changes) + "Add/remove tags from all messages in current search buffer. + +-- +1.7.9.1 + -- 2.26.2