Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / b2 / 08dd001bd28279c73a7eaaa217050a76912713
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 7FAE0431FB6\r
6         for <notmuch@notmuchmail.org>; Wed,  4 Jul 2012 01:34:15 -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 SnCYA8fiMv2h for <notmuch@notmuchmail.org>;\r
17         Wed,  4 Jul 2012 01:34:14 -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 90F49431FAE\r
22         for <notmuch@notmuchmail.org>; Wed,  4 Jul 2012 01:34:14 -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 1SmL2K-0005LK-Ol; Wed, 04 Jul 2012 09:34:13 +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 1SmL2K-0002hU-Dv; Wed, 04 Jul 2012 09:34:12 +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 3/8] emacs: Move search-target logic to\r
35         `notmuch-search-show-result'\r
36 In-Reply-To: <1341354059-29396-4-git-send-email-amdragon@mit.edu>\r
37 References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>\r
38         <1341354059-29396-4-git-send-email-amdragon@mit.edu>\r
39 User-Agent: Notmuch/0.13.2+70~gb6a56e7 (http://notmuchmail.org) Emacs/23.4.1\r
40         (x86_64-pc-linux-gnu)\r
41 Date: Wed, 04 Jul 2012 09:34:09 +0100\r
42 Message-ID: <87hatnhqm6.fsf@qmul.ac.uk>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 X-Sender-Host-Address: 94.192.233.223\r
46 X-QM-SPAM-Info: Sender has good ham record.  :)\r
47 X-QM-Body-MD5: e6ed7f90d13674af4b0346a8140fd1b7 (of first 20000 bytes)\r
48 X-SpamAssassin-Score: -1.8\r
49 X-SpamAssassin-SpamBar: -\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
51         determine if it is\r
52         spam. We require at least 5.0 points to mark a message as spam.\r
53         This message scored -1.8 points.\r
54         Summary of the scoring: \r
55         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
56         *      medium trust\r
57         *      [138.37.6.40 listed in list.dnswl.org]\r
58         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
59         provider *      (markwalters1009[at]gmail.com)\r
60         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
61         *      domain\r
62         *  0.5 AWL AWL: From: address is in the auto white-list\r
63 X-QM-Scan-Virus: ClamAV says the message is clean\r
64 Cc: tomi.ollila@iki.fi\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Wed, 04 Jul 2012 08:34:15 -0000\r
78 \r
79 On Tue, 03 Jul 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
80 > This is a simpler place to do this, since we can avoid any point\r
81 > motion and hence any save-excursions in\r
82 > `notmuch-search-process-filter', which in turn lets us put all of the\r
83 > search-target logic outside of any save-excursions.\r
84 >\r
85 > `notmuch-search-process-filter' could use some reindentation after\r
86 > this, but we're about to rewrite it entirely, so we won't bother.\r
87 > ---\r
88 >  emacs/notmuch.el |   33 +++++++++++++++------------------\r
89 >  1 file changed, 15 insertions(+), 18 deletions(-)\r
90 >\r
91 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
92 > index dadc6d6..4a6490a 100644\r
93 > --- a/emacs/notmuch.el\r
94 > +++ b/emacs/notmuch.el\r
95 > @@ -729,24 +729,27 @@ non-authors is found, assume that all of the authors match."\r
96 >  (defun notmuch-search-show-result (thread-id date count authors subject tags)\r
97 >    ;; Ignore excluded matches\r
98 >    (unless (eq (aref count 1) ?0)\r
99 > -    (let ((beg (point))\r
100 > +    (let ((beg (point-max))\r
101 >         (tags-str (mapconcat 'identity tags " ")))\r
102 > -      (dolist (format notmuch-search-result-format)\r
103 > -     (notmuch-search-insert-field (car format) (cdr format)\r
104 > -                                  date count authors subject tags-str))\r
105 > -      (insert "\n")\r
106 > -      (notmuch-search-color-line beg (point) tags)\r
107 > -      (put-text-property beg (point) 'notmuch-search-thread-id thread-id)\r
108 > -      (put-text-property beg (point) 'notmuch-search-authors authors)\r
109 > -      (put-text-property beg (point) 'notmuch-search-subject subject))))\r
110 > +      (save-excursion\r
111 > +     (goto-char beg)\r
112 > +     (dolist (format notmuch-search-result-format)\r
113 > +       (notmuch-search-insert-field (car format) (cdr format)\r
114 > +                                    date count authors subject tags-str))\r
115 > +     (insert "\n")\r
116 > +     (notmuch-search-color-line beg (point) tags)\r
117 > +     (put-text-property beg (point) 'notmuch-search-thread-id thread-id)\r
118 > +     (put-text-property beg (point) 'notmuch-search-authors authors)\r
119 > +     (put-text-property beg (point) 'notmuch-search-subject subject))\r
120 > +      (when (string= thread-id notmuch-search-target-thread)\r
121 > +     (setq notmuch-search-target-thread "found")\r
122 > +     (goto-char beg)))))\r
123 >  \r
124 >  (defun notmuch-search-process-filter (proc string)\r
125 >    "Process and filter the output of \"notmuch search\""\r
126 > -  (let ((buffer (process-buffer proc))\r
127 > -     (found-target nil))\r
128 > +  (let ((buffer (process-buffer proc)))\r
129 >      (if (buffer-live-p buffer)\r
130 >       (with-current-buffer buffer\r
131 > -       (save-excursion\r
132 >           (let ((line 0)\r
133 >                 (more t)\r
134 >                 (inhibit-read-only t)\r
135 > @@ -763,12 +766,8 @@ non-authors is found, assume that all of the authors match."\r
136 >                          (subject (match-string 5 string))\r
137 >                          (tags (match-string 6 string))\r
138 >                          (tag-list (if tags (save-match-data (split-string tags)))))\r
139 > -                   (goto-char (point-max))\r
140 >                     (if (/= (match-beginning 1) line)\r
141 >                         (insert (concat "Error: Unexpected output from notmuch search:\n" (substring string line (match-beginning 1)) "\n")))\r
142 \r
143 Does this mean that error information now comes just before the matching\r
144 thread, rather than at the place in the thread list the error actually\r
145 occurs? This is not a complaint: just everything else looks like it is\r
146 functionally equivalent. (Maybe it is all made irrelevant by a later\r
147 patch anyway).\r
148 \r
149 Best wishes\r
150 \r
151 Mark\r
152 \r
153 \r
154 > -                   (when (string= thread-id notmuch-search-target-thread)\r
155 > -                     (set 'found-target (point))\r
156 > -                     (set 'notmuch-search-target-thread "found"))\r
157 >                     (notmuch-search-show-result thread-id date count authors subject tag-list)\r
158 >                     (set 'line (match-end 0)))\r
159 >                 (set 'more nil)\r
160 > @@ -777,8 +776,6 @@ non-authors is found, assume that all of the authors match."\r
161 >                 (if (< line (length string))\r
162 >                     (setq notmuch-search-process-filter-data (substring string line)))\r
163 >                 ))))\r
164 > -       (if found-target\r
165 > -           (goto-char found-target)))\r
166 >        (delete-process proc))))\r
167 >  \r
168 >  (defun notmuch-search-tag-all (&optional tag-changes)\r
169 > -- \r
170 > 1.7.10\r
171 >\r
172 > _______________________________________________\r
173 > notmuch mailing list\r
174 > notmuch@notmuchmail.org\r
175 > http://notmuchmail.org/mailman/listinfo/notmuch\r