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 2134A41A546 for ; Tue, 30 Nov 2010 03:00:46 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 1.363 X-Spam-Level: * X-Spam-Status: No, score=1.363 tagged_above=-999 required=5 tests=[RDNS_DYNAMIC=0.363, TO_NO_BRKTS_DYNIP=1] 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 B7ELlyp1I-7G for ; Tue, 30 Nov 2010 03:00:44 -0800 (PST) Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com [81.149.164.25]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 7D64441A541 for ; Tue, 30 Nov 2010 03:00:43 -0800 (PST) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id 69DD0594235; Tue, 30 Nov 2010 11:00:28 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH 2/4] emacs: Use a plists rather than an assoc list in JSON search. Date: Tue, 30 Nov 2010 11:00:23 +0000 Message-Id: <1291114825-3513-2-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1291026599-14795-4-git-send-email-dme@dme.org> References: <1291026599-14795-4-git-send-email-dme@dme.org> 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: Tue, 30 Nov 2010 11:00:46 -0000 For commonality with the `notmuch-show' code, prefer plists over associative lists. --- emacs/notmuch.el | 17 +++++++++-------- 1 files changed, 9 insertions(+), 8 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index f4aefc8..d561c6e 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -700,14 +700,14 @@ foreground and blue background." (insert "\n")) (defun notmuch-search-process-insert-object (object) - (let* ((thread-id (concat "thread:" (cdr (assoc 'thread object)))) - (date (format "%12s" (cdr (assoc 'date_relative object)))) + (let* ((thread-id (concat "thread:" (plist-get object :thread))) + (date (format "%12s" (plist-get object :date_relative))) (count (format "[%d/%d]" - (cdr (assoc 'matched object)) - (cdr (assoc 'total object)))) - (authors (cdr (assoc 'authors object))) - (subject (cdr (assoc 'subject object))) - (tag-list (cdr (assoc 'tags object))) + (plist-get object :matched) + (plist-get object :total))) + (authors (plist-get object :authors)) + (subject (plist-get object :subject)) + (tag-list (plist-get object :tags)) (tags (mapconcat 'identity tag-list " ")) (beg (point-marker))) (notmuch-search-show-result date count authors subject tags) @@ -724,7 +724,8 @@ foreground and blue background." (let ((inhibit-read-only t) (inhibit-redisplay t) ;; Vectors are not as useful here. - (json-array-type 'list)) + (json-array-type 'list) + (json-object-type 'plist)) (save-excursion ;; Insert the text, advancing the process marker (goto-char (point-max)) -- 1.7.2.3