From: Mark Walters Date: Wed, 24 Oct 2012 00:13:21 +0000 (+0100) Subject: [PATCH v3 2/3] emacs: Rename incremental JSON internal variables. X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=455a5c4ca57bb7e619782c6d277a32398d9d1638;p=notmuch-archives.git [PATCH v3 2/3] emacs: Rename incremental JSON internal variables. --- diff --git a/06/8a3a53eccd566054c6beebd3963bc9993f1f1b b/06/8a3a53eccd566054c6beebd3963bc9993f1f1b new file mode 100644 index 000000000..628ee5909 --- /dev/null +++ b/06/8a3a53eccd566054c6beebd3963bc9993f1f1b @@ -0,0 +1,152 @@ +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 A259B431FC0 + for ; Tue, 23 Oct 2012 17:13:50 -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 7sT1hkUgQ3Ac for ; + Tue, 23 Oct 2012 17:13:49 -0700 (PDT) +Received: from mail-we0-f181.google.com (mail-we0-f181.google.com + [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 2EF4E431FC9 + for ; Tue, 23 Oct 2012 17:13:48 -0700 (PDT) +Received: by mail-we0-f181.google.com with SMTP id u54so2726156wey.26 + for ; Tue, 23 Oct 2012 17:13:46 -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=8wez/w0wRY3dRCLyp0MVlQfsqPVN0HTMnX39ePhaNKc=; + b=mXceZQ7iIPOsgwytXLTcHNovwmqna/phJjvkVB0ZrZfBUBd26wMb/aM6mnOXE/WKyC + 1IQAMSbDZtEj0GGUpZvmq+n82sWGF6S/qzj/CEaYGsuwnAkCeLZa6iV0zzEFvwexyOcG + Rq+TYk3ANxV86M+jefiDxJ2X5Pb2hMyLUNko84SQZMKNf3WRK6+mAmIUbtGN+OU+2jFr + mQQwGCO5EEUXvxJhmfCakbR8+749eUb9997tqY2bvNleXC7Ym0sgX2+xDPaawF2UP+RJ + oScA6p8rPDdwmW9GPDRl2yqYiOLiEZlbE4umbNUfLn5OTJNnXGGnVDlSgWrd7mMaaQyR + XoRg== +Received: by 10.216.145.88 with SMTP id o66mr8714244wej.169.1351037626748; + Tue, 23 Oct 2012 17:13:46 -0700 (PDT) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPS id k20sm1387790wiv.11.2012.10.23.17.13.45 + (version=TLSv1/SSLv3 cipher=OTHER); + Tue, 23 Oct 2012 17:13:45 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v3 2/3] emacs: Rename incremental JSON internal variables. +Date: Wed, 24 Oct 2012 01:13:21 +0100 +Message-Id: <1351037602-11157-3-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:51 -0000 + +This patch just renames the internal variables for the JSON parser now +it is no longer specific to search mode. It also fixes up the white +space after the previous patch. There should be no functional changes. +--- + emacs/notmuch.el | 46 +++++++++++++++++++++++----------------------- + 1 files changed, 23 insertions(+), 23 deletions(-) + +diff --git a/emacs/notmuch.el b/emacs/notmuch.el +index 72a73dc..7e5d052 100644 +--- a/emacs/notmuch.el ++++ b/emacs/notmuch.el +@@ -812,11 +812,11 @@ non-authors is found, assume that all of the authors match." + (insert (apply #'format string objects)) + (insert "\n"))) + +-(defvar notmuch-search-process-state nil +- "Parsing state of the search process filter.") ++(defvar notmuch-json-state nil ++ "State of the internal JSON parser.") + +-(defvar notmuch-search-json-parser nil +- "Incremental JSON parser for the search process filter.") ++(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\"" +@@ -848,40 +848,40 @@ If there is a syntax error, this will attempt to resynchronize + with the input and will apply ERROR-FUNCTION in buffer + RESULT-BUFFER to any input that was skipped." + (let (done) +- (unless (local-variable-p 'notmuch-search-json-parser) +- (set (make-local-variable 'notmuch-search-json-parser) ++ (unless (local-variable-p 'notmuch-json-parser) ++ (set (make-local-variable 'notmuch-json-parser) + (notmuch-json-create-parser (current-buffer))) +- (set (make-local-variable 'notmuch-search-process-state) 'begin)) +- (while (not done) +- (condition-case nil +- (case notmuch-search-process-state ++ (set (make-local-variable 'notmuch-json-state) 'begin)) ++ (while (not done) ++ (condition-case nil ++ (case notmuch-json-state + ((begin) + ;; Enter the results list + (if (eq (notmuch-json-begin-compound +- notmuch-search-json-parser) 'retry) ++ notmuch-json-parser) 'retry) + (setq done t) +- (setq notmuch-search-process-state 'result))) ++ (setq notmuch-json-state 'result))) + ((result) + ;; Parse a result +- (let ((result (notmuch-json-read notmuch-search-json-parser))) ++ (let ((result (notmuch-json-read notmuch-json-parser))) + (case result +- ((retry) (setq done t)) +- ((end) (setq notmuch-search-process-state 'end)) ++ ((retry) (setq done t)) ++ ((end) (setq notmuch-json-state 'end)) + (otherwise (with-current-buffer results-buf + (funcall result-function result)))))) + ((end) + ;; Any trailing data is unexpected +- (notmuch-json-eof notmuch-search-json-parser) ++ (notmuch-json-eof notmuch-json-parser) + (setq done t))) +- (json-error +- ;; Do our best to resynchronize and ensure forward +- ;; progress +- (let ((bad (buffer-substring (line-beginning-position) +- (line-end-position)))) +- (forward-line) ++ (json-error ++ ;; Do our best to resynchronize and ensure forward ++ ;; progress ++ (let ((bad (buffer-substring (line-beginning-position) ++ (line-end-position)))) ++ (forward-line) + (with-current-buffer results-buf + (funcall error-function "%s" bad)))))) +- ;; Clear out what we've parsed ++ ;; Clear out what we've parsed + (delete-region (point-min) (point)))) + + (defun notmuch-search-tag-all (&optional tag-changes) +-- +1.7.9.1 +