Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / 1b / c7023b6b0e38c480208a53467db63b9d9a8e52
1 Return-Path: <tomi.ollila@iki.fi>\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 E895C431FBC\r
6         for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 07:54:29 -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: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 OPr4bmucks1v for <notmuch@notmuchmail.org>;\r
16         Sat, 15 Dec 2012 07:54:27 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 97A0E431FB6\r
19         for <notmuch@notmuchmail.org>; Sat, 15 Dec 2012 07:54:27 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id D30DD10007E;\r
22         Sat, 15 Dec 2012 17:54:21 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] emacs: Fix bug in resynchronizing after a JSON parse\r
26  error\r
27 In-Reply-To: <1355497655-9571-1-git-send-email-amdragon@mit.edu>\r
28 References: <1355497655-9571-1-git-send-email-amdragon@mit.edu>\r
29 User-Agent: Notmuch/0.14+116~g29fcdb5 (http://notmuchmail.org) Emacs/24.2.1\r
30         (x86_64-unknown-linux-gnu)\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
32         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
33         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
34 Date: Sat, 15 Dec 2012 17:54:21 +0200\r
35 Message-ID: <m2r4mrpaz6.fsf@guru.guru-group.fi>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Sat, 15 Dec 2012 15:54:30 -0000\r
51 \r
52 On Fri, Dec 14 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
53 \r
54 > Previously, if the input stream consisted only of an error message,\r
55 > notmuch-json-begin-compound would signal a (wrong-type-argument\r
56 > number-or-marker-p nil) error when reaching the end of the error\r
57 > message.  This happened because notmuch-json-scan-to-value would think\r
58 > that it reached a value and put the parser into the 'value state.\r
59 > Even after notmuch-json-begin-compound signaled the syntax error, the\r
60 > parser would remain in this state and when the resynchronization logic\r
61 > reached the end of the buffer, the parser would fail because the\r
62 > 'value state indicates that characters are available.\r
63 >\r
64 > This fixes this problem by restoring the parser's previous state if it\r
65 > encounters a syntax error.\r
66 > ---\r
67 \r
68 I couldn't understand this (setf... even reading the docstring\r
69 (and no time to experiment)\r
70 anyway the code change is pretty trivial and i cannot see what\r
71 it could break. I believe the code works as expected, so\r
72 \r
73 +1\r
74 \r
75 Tomi\r
76 \r
77 >\r
78 > This patch was already okayed by Mark Walters [0] in the context of a\r
79 > larger series.  Since it's independent of that larger series, I'm\r
80 > re-sending it separately.\r
81 >\r
82 > [0] id:87hanxgczt.fsf@qmul.ac.uk\r
83 >\r
84 >  emacs/notmuch-lib.el |   22 +++++++++++++---------\r
85 >  1 file changed, 13 insertions(+), 9 deletions(-)\r
86 >\r
87 > diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
88 > index 9c4ee71..fb6d3e7 100644\r
89 > --- a/emacs/notmuch-lib.el\r
90 > +++ b/emacs/notmuch-lib.el\r
91 > @@ -465,15 +465,19 @@ Entering JSON objects is currently unimplemented."\r
92 >    (with-current-buffer (notmuch-json-buffer jp)\r
93 >      ;; Disallow terminators\r
94 >      (setf (notmuch-json-allow-term jp) nil)\r
95 > -    (or (notmuch-json-scan-to-value jp)\r
96 > -     (if (/= (char-after) ?\[)\r
97 > -         (signal 'json-readtable-error (list "expected '['"))\r
98 > -       (forward-char)\r
99 > -       (push ?\] (notmuch-json-term-stack jp))\r
100 > -       ;; Expect a value or terminator next\r
101 > -       (setf (notmuch-json-next jp) 'expect-value\r
102 > -             (notmuch-json-allow-term jp) t)\r
103 > -       t))))\r
104 > +    ;; Save "next" so we can restore it if there's a syntax error\r
105 > +    (let ((saved-next (notmuch-json-next jp)))\r
106 > +      (or (notmuch-json-scan-to-value jp)\r
107 > +       (if (/= (char-after) ?\[)\r
108 > +           (progn\r
109 > +             (setf (notmuch-json-next jp) saved-next)\r
110 > +             (signal 'json-readtable-error (list "expected '['")))\r
111 > +         (forward-char)\r
112 > +         (push ?\] (notmuch-json-term-stack jp))\r
113 > +         ;; Expect a value or terminator next\r
114 > +         (setf (notmuch-json-next jp) 'expect-value\r
115 > +               (notmuch-json-allow-term jp) t)\r
116 > +         t)))))\r
117 >  \r
118 >  (defun notmuch-json-read (jp)\r
119 >    "Parse the value at point in JP's buffer.\r
120 > -- \r
121 > 1.7.10.4\r
122 >\r
123 > _______________________________________________\r
124 > notmuch mailing list\r
125 > notmuch@notmuchmail.org\r
126 > http://notmuchmail.org/mailman/listinfo/notmuch\r