Re: [RFC PATCH 1/1] add --stderr option
[notmuch-archives.git] / b2 / 1ad8744d6f2d224ac1f768604776cd1b982b42
1 Return-Path: <m.walters@qmul.ac.uk>\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 0163B431FAF\r
6         for <notmuch@notmuchmail.org>; Sun, 22 Jul 2012 08:28:04 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id m+h77mIIIfIE for <notmuch@notmuchmail.org>;\r
17         Sun, 22 Jul 2012 08:28:00 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 2723F431FAE\r
22         for <notmuch@notmuchmail.org>; Sun, 22 Jul 2012 08:28:00 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1Ssy4W-0005S7-Sx; Sun, 22 Jul 2012 16:27:55 +0100\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1Ssy4W-0004UL-FF; Sun, 22 Jul 2012 16:27:52 +0100\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
34 Subject: Re: [PATCH v4 0/8] emacs: JSON-based search cleanups\r
35 In-Reply-To: <1342892232-5659-1-git-send-email-amdragon@mit.edu>\r
36 References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
37         <1342892232-5659-1-git-send-email-amdragon@mit.edu>\r
38 User-Agent: Notmuch/0.13.2+82~g23d46be (http://notmuchmail.org) Emacs/23.4.1\r
39         (x86_64-pc-linux-gnu)\r
40 Date: Sun, 22 Jul 2012 16:27:53 +0100\r
41 Message-ID: <877gtvq0hy.fsf@qmul.ac.uk>\r
42 MIME-Version: 1.0\r
43 Content-Type: text/plain; charset=us-ascii\r
44 X-Sender-Host-Address: 94.192.233.223\r
45 X-QM-SPAM-Info: Sender has good ham record.  :)\r
46 X-QM-Body-MD5: 7fa17d740af2e6d74b4853cc7a622086 (of first 20000 bytes)\r
47 X-SpamAssassin-Score: -1.8\r
48 X-SpamAssassin-SpamBar: -\r
49 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
50         determine if it is\r
51         spam. We require at least 5.0 points to mark a message as spam.\r
52         This message scored -1.8 points.\r
53         Summary of the scoring: \r
54         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
55         *      medium trust\r
56         *      [138.37.6.40 listed in list.dnswl.org]\r
57         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
58         provider *      (markwalters1009[at]gmail.com)\r
59         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
60         *      domain\r
61         *  0.5 AWL AWL: From: address is in the auto white-list\r
62 X-QM-Scan-Virus: ClamAV says the message is clean\r
63 X-BeenThere: notmuch@notmuchmail.org\r
64 X-Mailman-Version: 2.1.13\r
65 Precedence: list\r
66 List-Id: "Use and development of the notmuch mail system."\r
67         <notmuch.notmuchmail.org>\r
68 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
70 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
71 List-Post: <mailto:notmuch@notmuchmail.org>\r
72 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
73 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
74         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
75 X-List-Received-Date: Sun, 22 Jul 2012 15:28:04 -0000\r
76 \r
77 \r
78 This version looks good to me +1\r
79 \r
80 Best wishes\r
81 \r
82 Mark\r
83 \r
84 On Sat, 21 Jul 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
85 > This version fixes several bugs found in the previous version.  I\r
86 > replaced the insert-before-markers trick in\r
87 > notmuch-search-update-result with direct point manipulation.  This\r
88 > fixes the problem with authors getting unhidden when a result is\r
89 > updated with point after the authors on the line (since it no longer\r
90 > deletes the region with the invisibility overlay).  I also removed the\r
91 > scrolling hack (which was partially necessitated by\r
92 > insert-before-markers), so that archiving the last visible result will\r
93 > properly scroll the buffer instead of jumping point to the middle of\r
94 > the visible window.  As a result, the window may scroll when updating\r
95 > a multiline result, however, it will scroll to show the entire result\r
96 > (unlike an earlier version where it scrolled to cut off the result\r
97 > because of an interaction with insert-before-markers).  Finally, I\r
98 > fixed notmuch-search-last-thread so that it behaves like it did before\r
99 > when there are no results, rather than failing with an obscure error.\r
100 >\r
101 > I also updated the customize documentation and NEWS to indicate that\r
102 > multiline search results are considered experimental.\r
103 >\r
104 > Diff from v3:\r
105 >\r
106 > diff --git a/NEWS b/NEWS\r
107 > index 7b33f0d..7b1f36c 100644\r
108 > --- a/NEWS\r
109 > +++ b/NEWS\r
110 > @@ -25,7 +25,7 @@ The formatting of tags in search results can now be customized\r
111 >    `notmuch-search-result-format` would usually break tagging from\r
112 >    search-mode.  We no longer make assumptions about the format.\r
113 >  \r
114 > -Multi-line search result formats are now supported\r
115 > +Experimental support for multi-line search result formats\r
116 >  \r
117 >    It is now possible to embed newlines in\r
118 >    `notmuch-search-result-format` to make individual search results\r
119 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
120 > index ec760dc..fd1836f 100644\r
121 > --- a/emacs/notmuch.el\r
122 > +++ b/emacs/notmuch.el\r
123 > @@ -70,12 +70,12 @@\r
124 >  For example:\r
125 >       (setq notmuch-search-result-format \(\(\"authors\" . \"%-40s\"\)\r
126 >                                            \(\"subject\" . \"%s\"\)\)\)\r
127 > -Line breaks are permitted in format strings.  Note that a line\r
128 > -break at the end of an \"authors\" field will get elided if the\r
129 > -authors list is long; place it instead at the beginning of the\r
130 > -following field.  To enter a line break when setting this\r
131 > -variable with setq, use \\n.  To enter a line break in customize,\r
132 > -press \\[quoted-insert] C-j."\r
133 > +Line breaks are permitted in format strings (though this is\r
134 > +currently experimental).  Note that a line break at the end of an\r
135 > +\"authors\" field will get elided if the authors list is long;\r
136 > +place it instead at the beginning of the following field.  To\r
137 > +enter a line break when setting this variable with setq, use \\n.\r
138 > +To enter a line break in customize, press \\[quoted-insert] C-j."\r
139 >    :type '(alist :key-type (string) :value-type (string))\r
140 >    :group 'notmuch-search)\r
141 >  \r
142 > @@ -310,7 +310,8 @@ For a mouse binding, return nil."\r
143 >    (interactive)\r
144 >    (goto-char (point-max))\r
145 >    (forward-line -2)\r
146 > -  (goto-char (notmuch-search-result-beginning)))\r
147 > +  (let ((beg (notmuch-search-result-beginning)))\r
148 > +    (when beg (goto-char beg))))\r
149 >  \r
150 >  (defun notmuch-search-first-thread ()\r
151 >    "Select the first thread in the search results."\r
152 > @@ -599,30 +600,31 @@ This function advances the next thread when finished."\r
153 >  \r
154 >  (defun notmuch-search-update-result (result &optional pos)\r
155 >    "Replace the result object of the thread at POS (or point) by\r
156 > -RESULT and redraw it."\r
157 > +RESULT and redraw it.\r
158 > +\r
159 > +This will keep point in a reasonable location.  However, if there\r
160 > +are enclosing save-excursions and the saved point is in the\r
161 > +result being updated, the point will be restored to the beginning\r
162 > +of the result."\r
163 >    (let ((start (notmuch-search-result-beginning pos))\r
164 >       (end (notmuch-search-result-end pos))\r
165 >       (init-point (point))\r
166 > -     (init-start (window-start))\r
167 >       (inhibit-read-only t))\r
168 >      ;; Delete the current thread\r
169 >      (delete-region start end)\r
170 >      ;; Insert the updated thread\r
171 >      (notmuch-search-show-result result start)\r
172 > -    ;; There may have been markers pointing into the text we just\r
173 > -    ;; replaced.  For the most part, there's nothing we can do about\r
174 > -    ;; this, but we can fix markers that were at point (which includes\r
175 > -    ;; point itself and any save-excursions for which point hasn't\r
176 > -    ;; moved) by re-inserting the text that should come before point\r
177 > -    ;; before markers.\r
178 > +    ;; If point was inside the old result, make an educated guess\r
179 > +    ;; about where to place it now.  Unfortunately, this won't work\r
180 > +    ;; with save-excursion (or any other markers that would be nice to\r
181 > +    ;; preserve, such as the window start), but there's nothing we can\r
182 > +    ;; do about that without a way to retrieve markers in a region.\r
183 >      (when (and (>= init-point start) (<= init-point end))\r
184 >        (let* ((new-end (notmuch-search-result-end start))\r
185 >            (new-point (if (= init-point end)\r
186 >                           new-end\r
187 >                         (min init-point (- new-end 1)))))\r
188 > -     (insert-before-markers (delete-and-extract-region start new-point))))\r
189 > -    ;; We also may have shifted the window scroll.  Fix it.\r
190 > -    (set-window-start (selected-window) init-start)))\r
191 > +     (goto-char new-point)))))\r
192 >  \r
193 >  (defun notmuch-search-process-sentinel (proc msg)\r
194 >    "Add a message to let user know when \"notmuch search\" exits"\r