Re: Flat search and threaded views
[notmuch-archives.git] / e2 / cc13c827b019b1b89cd328526c1b3ca7451297
1 Return-Path: <dme@ut.hh.sledj.net>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 44FDE41A547\r
6         for <notmuch@notmuchmail.org>; Tue, 30 Nov 2010 03:00:41 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 1.363\r
10 X-Spam-Level: *\r
11 X-Spam-Status: No, score=1.363 tagged_above=-999 required=5\r
12         tests=[RDNS_DYNAMIC=0.363, TO_NO_BRKTS_DYNIP=1] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id F35gGCu46gRD for <notmuch@notmuchmail.org>;\r
16         Tue, 30 Nov 2010 03:00:40 -0800 (PST)\r
17 Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com\r
18         [81.149.164.25])\r
19         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id D2A80431FB6\r
22         for <notmuch@notmuchmail.org>; Tue, 30 Nov 2010 03:00:39 -0800 (PST)\r
23 Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
24         id 6CA1A59422B; Tue, 30 Nov 2010 11:00:29 +0000 (GMT)\r
25 From: David Edmondson <dme@dme.org>\r
26 To: notmuch@notmuchmail.org\r
27 Subject: [PATCH 4/4] emacs: Fix indentation, add comments.\r
28 Date: Tue, 30 Nov 2010 11:00:25 +0000\r
29 Message-Id: <1291114825-3513-4-git-send-email-dme@dme.org>\r
30 X-Mailer: git-send-email 1.7.2.3\r
31 In-Reply-To: <1291026599-14795-4-git-send-email-dme@dme.org>\r
32 References: <1291026599-14795-4-git-send-email-dme@dme.org>\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.13\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Tue, 30 Nov 2010 11:00:41 -0000\r
46 \r
47 `inhibit-redisplay' makes debugging hard - note this in a comment.\r
48 ---\r
49  emacs/notmuch.el |   81 ++++++++++++++++++++++++++++--------------------------\r
50  1 files changed, 42 insertions(+), 39 deletions(-)\r
51 \r
52 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
53 index d561c6e..20d954b 100644\r
54 --- a/emacs/notmuch.el\r
55 +++ b/emacs/notmuch.el\r
56 @@ -722,10 +722,13 @@ foreground and blue background."\r
57  (defun notmuch-search-process-insert (proc buffer string)\r
58    (with-current-buffer buffer\r
59      (let ((inhibit-read-only t)\r
60 +         ;; Comment out this next line to allow useful single-step\r
61 +         ;; during debugging.\r
62           (inhibit-redisplay t)\r
63           ;; Vectors are not as useful here.\r
64           (json-array-type 'list)\r
65           (json-object-type 'plist))\r
66 +\r
67        (save-excursion\r
68         ;; Insert the text, advancing the process marker\r
69         (goto-char (point-max))\r
70 @@ -739,46 +742,46 @@ foreground and blue background."\r
71  \r
72        (save-excursion\r
73         (goto-char notmuch-search-parse-start)\r
74 -           (while\r
75 -               (let ((next-char (json-peek)))\r
76 -                 (cond\r
77 -                  ;; No more data (yet).\r
78 -                  ((eq next-char :json-eof)\r
79 -                   nil)\r
80 -\r
81 -                  ;; Opening bracket or comma separator between\r
82 -                  ;; objects.\r
83 -                  ((or (char-equal next-char ?\[)\r
84 -                       (char-equal next-char ?\,))\r
85 -                   (json-advance)\r
86 -                   (delete-region notmuch-search-parse-start (point))\r
87 -                   t)\r
88 -\r
89 -                  ;; Closing array.\r
90 -                  ((char-equal next-char ?\])\r
91 -                   ;; Consume both the closing bracket and any trailing\r
92 -                   ;; whitespace (typically a carriage return).\r
93 -                   (json-advance)\r
94 -                   (json-skip-whitespace)\r
95 -                   (delete-region notmuch-search-parse-start (point))\r
96 -                   nil)\r
97 -\r
98 -                  ;; Single object.\r
99 -                  ((condition-case nil\r
100 -                       (let ((object (json-read-object)))\r
101 -                         ;; Delete the object that we consumed.\r
102 -                         (delete-region notmuch-search-parse-start (point))\r
103 -                         ;; Insert the corresponding results.\r
104 -                         (notmuch-search-process-insert-object object)\r
105 -                         t)\r
106 -                     (error nil)))))\r
107 -\r
108 -             ;; Consume any white space between terms.\r
109 -             (let ((p (point)))\r
110 +       (while\r
111 +           (let ((next-char (json-peek)))\r
112 +             (cond\r
113 +              ;; No more data (yet).\r
114 +              ((eq next-char :json-eof)\r
115 +               nil)\r
116 +\r
117 +              ;; Opening bracket or comma separator between\r
118 +              ;; objects.\r
119 +              ((or (char-equal next-char ?\[)\r
120 +                   (char-equal next-char ?\,))\r
121 +               (json-advance)\r
122 +               (delete-region notmuch-search-parse-start (point))\r
123 +               t)\r
124 +\r
125 +              ;; Closing array.\r
126 +              ((char-equal next-char ?\])\r
127 +               ;; Consume both the closing bracket and any trailing\r
128 +               ;; whitespace (typically a carriage return).\r
129 +               (json-advance)\r
130                 (json-skip-whitespace)\r
131 -               (delete-region p (point)))\r
132 -             ;; Remember where we got up to.\r
133 -             (setq notmuch-search-parse-start (point)))))))\r
134 +               (delete-region notmuch-search-parse-start (point))\r
135 +               nil)\r
136 +\r
137 +              ;; Single object.\r
138 +              ((condition-case nil\r
139 +                   (let ((object (json-read-object)))\r
140 +                     ;; Delete the object that we consumed.\r
141 +                     (delete-region notmuch-search-parse-start (point))\r
142 +                     ;; Insert the corresponding results.\r
143 +                     (notmuch-search-process-insert-object object)\r
144 +                     t)\r
145 +                 (error nil)))))\r
146 +\r
147 +         ;; Consume any white space between terms.\r
148 +         (let ((p (point)))\r
149 +           (json-skip-whitespace)\r
150 +           (delete-region p (point)))\r
151 +         ;; Remember where we got up to.\r
152 +         (setq notmuch-search-parse-start (point)))))))\r
153  \r
154  (defun notmuch-search-process-filter (proc string)\r
155    "Process and filter the output of `notmuch search'."\r
156 -- \r
157 1.7.2.3\r
158 \r