1 Return-Path: <amdragon@mit.edu>
\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 A15E6429E26
\r
6 for <notmuch@notmuchmail.org>; Mon, 9 Jul 2012 14:42:55 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 Wp1CQwayWa+R for <notmuch@notmuchmail.org>;
\r
16 Mon, 9 Jul 2012 14:42:54 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 02331429E31
\r
20 for <notmuch@notmuchmail.org>; Mon, 9 Jul 2012 14:42:50 -0700 (PDT)
\r
21 X-AuditID: 1209190e-b7fb56d0000008b2-57-4ffb5058ad69
\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
23 by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id E6.51.02226.8505BFF4; Mon, 9 Jul 2012 17:42:48 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q69Lglak030908;
\r
27 Mon, 9 Jul 2012 17:42:47 -0400
\r
28 Received: from drake.dyndns.org (26-4-176.dynamic.csail.mit.edu [18.26.4.176])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q69LgiKb022685
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Mon, 9 Jul 2012 17:42:45 -0400 (EDT)
\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1SoLjA-0004fx-0l; Mon, 09 Jul 2012 17:42:44 -0400
\r
37 From: Austin Clements <amdragon@MIT.EDU>
\r
38 To: notmuch@notmuchmail.org
\r
39 Subject: [PATCH v3 4/9] emacs: Move search-target logic to
\r
40 `notmuch-search-show-result'
\r
41 Date: Mon, 9 Jul 2012 17:42:37 -0400
\r
42 Message-Id: <1341870162-17782-5-git-send-email-amdragon@mit.edu>
\r
43 X-Mailer: git-send-email 1.7.10
\r
44 In-Reply-To: <1341870162-17782-1-git-send-email-amdragon@mit.edu>
\r
45 References: <1341354059-29396-1-git-send-email-amdragon@mit.edu>
\r
46 <1341870162-17782-1-git-send-email-amdragon@mit.edu>
\r
47 X-Brightmail-Tracker:
\r
48 H4sIAAAAAAAAA+NgFjrKIsWRmVeSWpSXmKPExsUixCmqrRsR8NvfYNkmHYvVc3ksrt+cyWzx
\r
49 ZuU8Vgdmj52z7rJ7HP66kMXj2apbzAHMUVw2Kak5mWWpRfp2CVwZd+fsYizYL1dxva2dpYFx
\r
50 m0QXIyeHhICJxOYF2xghbDGJC/fWs4HYQgL7GCXunKjvYuQCstczSsz6M5MVwjnJJPHlQwcb
\r
51 hDOXUeLhx4vMIC1sAhoS2/YvBxslIiAtsfPubFYQm1kgTmLLlP9gcWGBcInTK0FWcHCwCKhK
\r
52 zFyhAhLmFXCQWLfhBhPEFfIST+/3gV3BKeAoMefmDkaIi8olPt/4xzyBkX8BI8MqRtmU3Crd
\r
53 3MTMnOLUZN3i5MS8vNQiXWO93MwSvdSU0k2M4NCS5NvB+PWg0iFGAQ5GJR7eaKbf/kKsiWXF
\r
54 lbmHGCU5mJREefM8gUJ8SfkplRmJxRnxRaU5qcWHGCU4mJVEeG+5AuV4UxIrq1KL8mFS0hws
\r
55 SuK8V1Ju+gsJpCeWpGanphakFsFkZTg4lCR4p/kDNQoWpaanVqRl5pQgpJk4OEGG8wANPwdS
\r
56 w1tckJhbnJkOkT/FqCglznsdJCEAksgozYPrhcX+K0ZxoFeEeXeAVPEA0wZc9yugwUxAg9t7
\r
57 foEMLklESEk1MGrNP/oiUaOg7dzSR1N8/t9NeL1yaqyTnWZa3P2cLR4n3UPXR1rxvNaQP/Pp
\r
58 /4y//28e3shs+mRdx1UG65CFgm6rRIMn7/vDVTpDpqDSaJqGnJSF0cGY9Is/3305dmvB3LmJ
\r
59 BQJaTK/Kbbrup72Q35K3LefB71luXjbVMybx9b6SKztnYH7xwAYlluKMREMt5qLiRADEo/LE
\r
61 Cc: tomi.ollila@iki.fi
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Mon, 09 Jul 2012 21:42:56 -0000
\r
76 This is a simpler place to do this, since we can avoid any point
\r
77 motion and hence any save-excursions in
\r
78 `notmuch-search-process-filter', which in turn lets us put all of the
\r
79 search-target logic outside of any save-excursions.
\r
81 `notmuch-search-show-{result,error}' are now responsible for their own
\r
84 `notmuch-search-process-filter' could use some reindentation after
\r
85 this, but we're about to rewrite it entirely, so we won't bother.
\r
87 emacs/notmuch.el | 41 ++++++++++++++++++++---------------------
\r
88 1 file changed, 20 insertions(+), 21 deletions(-)
\r
90 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
91 index f952fa8..5bf01ca 100644
\r
92 --- a/emacs/notmuch.el
\r
93 +++ b/emacs/notmuch.el
\r
94 @@ -730,29 +730,34 @@ non-authors is found, assume that all of the authors match."
\r
95 (defun notmuch-search-show-result (thread-id date count authors subject tags)
\r
96 ;; Ignore excluded matches
\r
97 (unless (eq (aref count 1) ?0)
\r
98 - (let ((beg (point))
\r
99 + (let ((beg (point-max))
\r
100 (tags-str (mapconcat 'identity tags " ")))
\r
101 - (dolist (spec notmuch-search-result-format)
\r
102 - (notmuch-search-insert-field (car spec) (cdr spec)
\r
103 - date count authors subject tags-str))
\r
105 - (notmuch-search-color-line beg (point) tags)
\r
106 - (put-text-property beg (point) 'notmuch-search-thread-id thread-id)
\r
107 - (put-text-property beg (point) 'notmuch-search-authors authors)
\r
108 - (put-text-property beg (point) 'notmuch-search-subject subject))))
\r
111 + (dolist (spec notmuch-search-result-format)
\r
112 + (notmuch-search-insert-field (car spec) (cdr spec)
\r
113 + date count authors subject tags-str))
\r
115 + (notmuch-search-color-line beg (point) tags)
\r
116 + (put-text-property beg (point) 'notmuch-search-thread-id thread-id)
\r
117 + (put-text-property beg (point) 'notmuch-search-authors authors)
\r
118 + (put-text-property beg (point) 'notmuch-search-subject subject))
\r
119 + (when (string= thread-id notmuch-search-target-thread)
\r
120 + (setq notmuch-search-target-thread "found")
\r
121 + (goto-char beg)))))
\r
123 (defun notmuch-search-show-error (string &rest objects)
\r
124 - (insert "Error: Unexpected output from notmuch search:\n")
\r
125 - (insert (apply #'format string objects))
\r
128 + (goto-char (point-max))
\r
129 + (insert "Error: Unexpected output from notmuch search:\n")
\r
130 + (insert (apply #'format string objects))
\r
133 (defun notmuch-search-process-filter (proc string)
\r
134 "Process and filter the output of \"notmuch search\""
\r
135 - (let ((buffer (process-buffer proc))
\r
136 - (found-target nil))
\r
137 + (let ((buffer (process-buffer proc)))
\r
138 (if (buffer-live-p buffer)
\r
139 (with-current-buffer buffer
\r
143 (inhibit-read-only t)
\r
144 @@ -769,13 +774,9 @@ non-authors is found, assume that all of the authors match."
\r
145 (subject (match-string 5 string))
\r
146 (tags (match-string 6 string))
\r
147 (tag-list (if tags (save-match-data (split-string tags)))))
\r
148 - (goto-char (point-max))
\r
149 (if (/= (match-beginning 1) line)
\r
150 (notmuch-search-show-error
\r
151 (substring string line (match-beginning 1))))
\r
152 - (when (string= thread-id notmuch-search-target-thread)
\r
153 - (set 'found-target (point))
\r
154 - (set 'notmuch-search-target-thread "found"))
\r
155 (notmuch-search-show-result thread-id date count authors subject tag-list)
\r
156 (set 'line (match-end 0)))
\r
158 @@ -784,8 +785,6 @@ non-authors is found, assume that all of the authors match."
\r
159 (if (< line (length string))
\r
160 (setq notmuch-search-process-filter-data (substring string line)))
\r
163 - (goto-char found-target)))
\r
164 (delete-process proc))))
\r
166 (defun notmuch-search-tag-all (&optional tag-changes)
\r