Re: [PATCH] doc: Allow rst2man.py as an alternative to rst2man
[notmuch-archives.git] / 83 / 430638b77e4aaa7a7b3e83dec845869f0a670a
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 1681C431FB6\r
6         for <notmuch@notmuchmail.org>; Fri, 13 Jul 2012 11:33:33 -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: -0.7\r
10 X-Spam-Level: \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 eAEQvN5cmui0 for <notmuch@notmuchmail.org>;\r
16         Fri, 13 Jul 2012 11:33:31 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
18         [18.9.25.13])\r
19         by olra.theworths.org (Postfix) with ESMTP id 504AE431FAE\r
20         for <notmuch@notmuchmail.org>; Fri, 13 Jul 2012 11:33:31 -0700 (PDT)\r
21 X-AuditID: 1209190d-b7fd56d000000933-a4-500069fa3b63\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id EB.C9.02355.AF960005; Fri, 13 Jul 2012 14:33:30 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q6DIXUet026676; \r
27         Fri, 13 Jul 2012 14:33:30 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\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 q6DIXS13018093\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Fri, 13 Jul 2012 14:33:29 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1SpkgC-0008BS-Km; Fri, 13 Jul 2012 14:33:28 -0400\r
37 Date: Fri, 13 Jul 2012 14:33:28 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Mark Walters <markwalters1009@gmail.com>\r
40 Subject: Re: [PATCH 3/7] emacs: Update tags by rewriting the search result\r
41         line in place\r
42 Message-ID: <20120713183328.GA31182@mit.edu>\r
43 References: <1342140319-19859-1-git-send-email-amdragon@mit.edu>\r
44         <1342140319-19859-4-git-send-email-amdragon@mit.edu>\r
45         <87a9z38ryo.fsf@qmul.ac.uk>\r
46 MIME-Version: 1.0\r
47 Content-Type: text/plain; charset=us-ascii\r
48 Content-Disposition: inline\r
49 In-Reply-To: <87a9z38ryo.fsf@qmul.ac.uk>\r
50 User-Agent: Mutt/1.5.21 (2010-09-15)\r
51 X-Brightmail-Tracker:\r
52  H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42IRYrdT0f2dyRBgcJvNYvVcHovrN2cyOzB5\r
53         7Jx1l93j2apbzAFMUVw2Kak5mWWpRfp2CVwZJw5/Yi/4r1Hx58gd9gbGZ/JdjJwcEgImElea\r
54         etggbDGJC/fWA9lcHEIC+xglJlzcwgjhbGCUeLX7MTuEc5JJYuGLv8wgLUICSxglTqwVBbFZ\r
55         BFQlLi19zgpiswloSGzbv5wRxBYR0JG4fWgBO4jNLCAt8e13MxOILSwQJbHvyjWgORwcvEA1\r
56         7bulIOZPZZTou3KcBaSGV0BQ4uTMJywQvVoSN/69ZAKpB5mz/B8HSJgTaNWljklgH4gKqEhM\r
57         ObmNbQKj0Cwk3bOQdM9C6F7AyLyKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI10gvN7NELzWldBMj\r
58         KKQ5JXl3ML47qHSIUYCDUYmHN9WfIUCINbGsuDL3EKMkB5OSKO/eVKAQX1J+SmVGYnFGfFFp\r
59         TmrxIUYJDmYlEV4dY6Acb0piZVVqUT5MSpqDRUmc90rKTX8hgfTEktTs1NSC1CKYrAwHh5IE\r
60         LzswdoUEi1LTUyvSMnNKENJMHJwgw3mAhpuC1PAWFyTmFmemQ+RPMSpKiUM0C4AkMkrz4Hph\r
61         KecVozjQK8K8vzOAqniA6Qqu+xXQYCagwbN+/vMHGlySiJCSamCc3Rud2Wnn9dVYN1npTU1Q\r
62         +Ht7t3iWxye5ko+6v6q0Et4UIXxglwC3SqvG5KzrvOdtWdf++lfrsv5llYoX/77HR9ZMEN5x\r
63         RKIyeHa8yZs3G5d8NJr5kGG76drbnzOYxFb1Gii3iLFOU5EvyLMt4qtdYC2o9eC8XraH4c+1\r
64         EzpOPdpVyP97cpQSS3FGoqEWc1FxIgCG7WFDFAMAAA==\r
65 Cc: notmuch@notmuchmail.org\r
66 X-BeenThere: notmuch@notmuchmail.org\r
67 X-Mailman-Version: 2.1.13\r
68 Precedence: list\r
69 List-Id: "Use and development of the notmuch mail system."\r
70         <notmuch.notmuchmail.org>\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
72         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
74 List-Post: <mailto:notmuch@notmuchmail.org>\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
77         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
78 X-List-Received-Date: Fri, 13 Jul 2012 18:33:33 -0000\r
79 \r
80 Quoth Mark Walters on Jul 13 at  6:57 pm:\r
81 > On Fri, 13 Jul 2012, Austin Clements <amdragon@MIT.EDU> wrote:\r
82 > > Now that we keep the full thread result object, we can refresh a\r
83 > > result after any changes by simply deleting and reconstructing the\r
84 > > result line from scratch.\r
85 > >\r
86 > > A convenient side-effect of this wholesale replacement is that search\r
87 > > now re-applies notmuch-search-line-faces when tags change.\r
88 > > ---\r
89 > >  emacs/notmuch.el |   55 ++++++++++++++++++++++++++++++------------------------\r
90 > >  1 file changed, 31 insertions(+), 24 deletions(-)\r
91 > >\r
92 > > diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
93 > > index 82c148d..2f83425 100644\r
94 > > --- a/emacs/notmuch.el\r
95 > > +++ b/emacs/notmuch.el\r
96 > > @@ -509,28 +509,12 @@ and will also appear in a buffer named \"*Notmuch errors*\"."\r
97 > >         (error (buffer-substring beg end))\r
98 > >         ))))))\r
99 > >  \r
100 > > -(defun notmuch-search-set-tags (tags)\r
101 > > -  (save-excursion\r
102 > > -    (end-of-line)\r
103 > > -    (re-search-backward "(")\r
104 > > -    (forward-char)\r
105 > > -    (let ((beg (point))\r
106 > > -     (inhibit-read-only t))\r
107 > > -      (re-search-forward ")")\r
108 > > -      (backward-char)\r
109 > > -      (let ((end (point)))\r
110 > > -   (delete-region beg end)\r
111 > > -   (insert (propertize (mapconcat  'identity tags " ")\r
112 > > -                       'face 'notmuch-tag-face))))))\r
113 > > -\r
114 > > -(defun notmuch-search-get-tags ()\r
115 > > -  (save-excursion\r
116 > > -    (end-of-line)\r
117 > > -    (re-search-backward "(")\r
118 > > -    (let ((beg (+ (point) 1)))\r
119 > > -      (re-search-forward ")")\r
120 > > -      (let ((end (- (point) 1)))\r
121 > > -   (split-string (buffer-substring-no-properties beg end))))))\r
122 > > +(defun notmuch-search-set-tags (tags &optional pos)\r
123 > > +  (let ((new-result (plist-put (notmuch-search-get-result pos) :tags tags)))\r
124 > > +    (notmuch-search-update-result new-result pos)))\r
125 > > +\r
126 > > +(defun notmuch-search-get-tags (&optional pos)\r
127 > > +  (plist-get (notmuch-search-get-result pos) :tags))\r
128 > >  \r
129 > >  (defun notmuch-search-get-tags-region (beg end)\r
130 > >    (save-excursion\r
131 > > @@ -583,6 +567,29 @@ This function advances the next thread when finished."\r
132 > >    (notmuch-search-tag '("-inbox"))\r
133 > >    (notmuch-search-next-thread))\r
134 > >  \r
135 > > +(defun notmuch-search-update-result (result &optional pos)\r
136 > > +  "Update the result object of the current thread and redraw it."\r
137\r
138 > I think this comment reads a little awkwardly. Maybe "Replace the result\r
139 > object of the current thread by RESULT and redraw it"?\r
140 \r
141 Better.  I should also say that it's the thread at POS (or point).\r
142 \r
143 > > +  (let ((start (notmuch-search-result-beginning pos))\r
144 > > +   (end (notmuch-search-result-end pos))\r
145 > > +   (init-point (point))\r
146 > > +   (inhibit-read-only t))\r
147 > > +    ;; Delete the current thread\r
148 > > +    (delete-region start end)\r
149 > > +    ;; Insert the updated thread\r
150 > > +    (notmuch-search-show-result result start)\r
151 > > +    ;; There may have been markers pointing into the text we just\r
152 > > +    ;; replaced.  For the most part, there's nothing we can do about\r
153 > > +    ;; this, but we can fix markers that were at point (which includes\r
154 > > +    ;; point itself and any save-excursions for which point hasn't\r
155 > > +    ;; moved) by re-inserting the text that should come before point\r
156 > > +    ;; before markers.\r
157 > > +    (when (and (>= init-point start) (<= init-point end))\r
158 > > +      (let* ((new-end (notmuch-search-result-end start))\r
159 > > +        (new-point (if (= init-point end)\r
160 > > +                       new-end\r
161 > > +                     (min init-point (- new-end 1)))))\r
162 > > +   (insert-before-markers (delete-and-extract-region start new-point))))))\r
163\r
164 > I think this doesn't always do quite the right thing with multiline\r
165 > results: the one that I can reproduce reliably is if you are on the\r
166 > second line of the first result, and the first line of this result is\r
167 > the first visible line in the window, and update it (eg by marking\r
168 > unread) then the window scrolls so that the second line of the first\r
169 > result is the first line visible in the window (ie the window scrolls up\r
170 > one line)\r
171 \r
172 Nice catch!  I really wish Emacs had a "replace text" function that\r
173 did sane things with markers and the window position and such; without\r
174 that anything I do is going to be finicky.  I'll see if saving and\r
175 restoring the window scroll position fixes this.\r
176 \r
177 > > +\r
178 > >  (defun notmuch-search-process-sentinel (proc msg)\r
179 > >    "Add a message to let user know when \"notmuch search\" exits"\r
180 > >    (let ((buffer (process-buffer proc))\r
181 > > @@ -745,10 +752,10 @@ non-authors is found, assume that all of the authors match."\r
182 > >                      (mapconcat 'identity (plist-get result :tags) " ")\r
183 > >                      'font-lock-face 'notmuch-tag-face) ")")))))\r
184 > >  \r
185 > > -(defun notmuch-search-show-result (result)\r
186 > > +(defun notmuch-search-show-result (result &optional pos)\r
187\r
188\r
189 > Perhaps a documentation line? along the lines of Insert RESULT in buffer\r
190 > at POS or the end of buffer.\r
191 \r
192 Good idea.\r
193 \r
194 > Best wishes\r
195\r
196 > Mark\r
197\r
198 > >    ;; Ignore excluded matches\r
199 > >    (unless (= (plist-get result :matched) 0)\r
200 > > -    (let ((beg (point-max)))\r
201 > > +    (let ((beg (or pos (point-max))))\r
202 > >        (save-excursion\r
203 > >     (goto-char beg)\r
204 > >     (dolist (spec notmuch-search-result-format)\r