Error with contrib/notmuch-pick
[notmuch-archives.git] / cd / bc460adf266b130ae7f1d1aec65913b2877c72
1 Return-Path: <pieter@praet.org>\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 66298429E25\r
6         for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:05:55 -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.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 T9p4aUI+tOKX for <notmuch@notmuchmail.org>;\r
16         Thu, 12 Jan 2012 09:05:51 -0800 (PST)\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com\r
18         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 7CB00431FB6\r
21         for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:05:51 -0800 (PST)\r
22 Received: by werm12 with SMTP id m12so1789752wer.26\r
23         for <notmuch@notmuchmail.org>; Thu, 12 Jan 2012 09:05:50 -0800 (PST)\r
24 Received: by 10.216.133.234 with SMTP id q84mr1931850wei.30.1326387950175;\r
25         Thu, 12 Jan 2012 09:05:50 -0800 (PST)\r
26 Received: from localhost ([109.131.126.209])\r
27         by mx.google.com with ESMTPS id gf8sm6440966wbb.11.2012.01.12.09.05.48\r
28         (version=TLSv1/SSLv3 cipher=OTHER);\r
29         Thu, 12 Jan 2012 09:05:49 -0800 (PST)\r
30 From: Pieter Praet <pieter@praet.org>\r
31 To: Jameson Graef Rollins <jrollins@finestructure.net>\r
32 Subject: Re: [PATCH] emacs: breakout notmuch-show-advance functionality from\r
33         notmuch-show-advance-and-archive\r
34 In-Reply-To: <87r517bs6e.fsf@praet.org>\r
35 References: <1321219008-11690-1-git-send-email-jrollins@finestructure.net>\r
36         <1321219008-11690-2-git-send-email-jrollins@finestructure.net>\r
37         <87r517bs6e.fsf@praet.org>\r
38 User-Agent: Notmuch/0.10.2+115~gadd29f6 (http://notmuchmail.org) Emacs/23.3.1\r
39         (x86_64-unknown-linux-gnu)\r
40 Date: Thu, 12 Jan 2012 18:04:10 +0100\r
41 Message-ID: <87r4z4lunp.fsf@praet.org>\r
42 MIME-Version: 1.0\r
43 Content-Type: text/plain; charset=us-ascii\r
44 Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
45 X-BeenThere: notmuch@notmuchmail.org\r
46 X-Mailman-Version: 2.1.13\r
47 Precedence: list\r
48 List-Id: "Use and development of the notmuch mail system."\r
49         <notmuch.notmuchmail.org>\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
53 List-Post: <mailto:notmuch@notmuchmail.org>\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
57 X-List-Received-Date: Thu, 12 Jan 2012 17:05:55 -0000\r
58 \r
59 On Wed, 16 Nov 2011 23:47:53 +0100, Pieter Praet <pieter@praet.org> wrote:\r
60 > On Sun, 13 Nov 2011 13:16:48 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:\r
61 > > This patch breaks out much of the functionality of\r
62 > > notmuch-show-advance-and-archive into a new function:\r
63 > > notmuch-show-advance.  This new function does all the advancing\r
64 > > through a show buffer that notmuch-show-advance-and-archive did,\r
65 > > without all the invasive thread archiving.  The return value of\r
66 > > notmuch-show-advance is nil if the bottom of the thread is not\r
67 > > reached, and t if it is.\r
68 > > \r
69 > > notmuch-show-advance-and-archive is modified to just call\r
70 > > notmuch-show-advance, and then call notmuch-show-archive-thread if the\r
71 > > return value is true.  In this way the previous functionality of\r
72 > > notmuch-show-advance-and-archive is preserved.\r
73 > > \r
74 > > This provides a way for people to rebind the space bar to a more sane\r
75 > > function if they don't like the default behavior.\r
76 > > ---\r
77 > >  emacs/notmuch-show.el |   38 +++++++++++++++++++++++---------------\r
78 > >  1 files changed, 23 insertions(+), 15 deletions(-)\r
79 > > \r
80 > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
81 > > index d5c95d8..a7f3263 100644\r
82 > > --- a/emacs/notmuch-show.el\r
83 > > +++ b/emacs/notmuch-show.el\r
84 > > @@ -1135,26 +1135,18 @@ All currently available key bindings:\r
85 > >  \r
86 > >  ;; Commands typically bound to keys.\r
87 > >  \r
88 > > -(defun notmuch-show-advance-and-archive ()\r
89 > > -  "Advance through thread and archive.\r
90 > > -\r
91 > > -This command is intended to be one of the simplest ways to\r
92 > > -process a thread of email. It does the following:\r
93 > > +(defun notmuch-show-advance ()\r
94 > > +  "Advance through thread.\r
95 > >  \r
96 > >  If the current message in the thread is not yet fully visible,\r
97 > >  scroll by a near screenful to read more of the message.\r
98 > >  \r
99 > >  Otherwise, (the end of the current message is already within the\r
100 > > -current window), advance to the next open message.\r
101 > > -\r
102 > > -Finally, if there is no further message to advance to, and this\r
103 > > -last message is already read, then archive the entire current\r
104 > > -thread, (remove the \"inbox\" tag from each message). Also kill\r
105 > > -this buffer, and display the next thread from the search from\r
106 > > -which this thread was originally shown."\r
107 > > +current window), advance to the next open message."\r
108 > >    (interactive)\r
109 > >    (let* ((end-of-this-message (notmuch-show-message-bottom))\r
110 > > -    (visible-end-of-this-message (1- end-of-this-message)))\r
111 > > +    (visible-end-of-this-message (1- end-of-this-message))\r
112 > > +    (ret nil))\r
113 > >      (while (invisible-p visible-end-of-this-message)\r
114 > >        (setq visible-end-of-this-message\r
115 > >         (previous-single-char-property-change visible-end-of-this-message\r
116 > > @@ -1173,8 +1165,24 @@ which this thread was originally shown."\r
117 > >        (notmuch-show-next-open-message))\r
118 > >  \r
119 > >       (t\r
120 > > -      ;; This is the last message - archive the thread.\r
121 > > -      (notmuch-show-archive-thread)))))\r
122 > > +      ;; This is the last message - change the return value\r
123 > > +      (setq ret t)))\r
124 > > +    ret))\r
125 > > +\r
126 > > +(defun notmuch-show-advance-and-archive ()\r
127 > > +  "Advance through thread and archive.\r
128 > > +\r
129 > > +This command is intended to be one of the simplest ways to\r
130 > > +process a thread of email. It works exactly like\r
131 > > +notmuch-show-advance, in that it scrolls through messages in a\r
132 > > +show buffer, except that when it gets to the end of the buffer it\r
133 > > +archives the entire current thread, (remove the \"inbox\" tag\r
134 > > +from each message), kills the buffer, and displays the next\r
135 > > +thread from the search from which this thread was originally\r
136 > > +shown."\r
137 > > +  (interactive)\r
138 > > +  (if (notmuch-show-advance)\r
139 > > +      (notmuch-show-archive-thread)))\r
140 > >  \r
141 > >  (defun notmuch-show-rewind ()\r
142 > >    "Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).\r
143 > > -- \r
144 > > 1.7.7.1\r
145 > > \r
146 > > _______________________________________________\r
147 > > notmuch mailing list\r
148 > > notmuch@notmuchmail.org\r
149 > > http://notmuchmail.org/mailman/listinfo/notmuch\r
150\r
151\r
152 > Nice one!\r
153\r
154 > Signed-off-by: Pieter Praet <pieter@praet.org>  ;)\r
155\r
156\r
157 > This has also exposed a pre-existing bug: When the last visible message\r
158 > is longer than a screenful and contains a *hidden* signature, you'll\r
159 > never get to see the end of it.\r
160\r
161 > The culprit is presumably seeking shelter from the flyswatter @\r
162 > `notmuch-show-message-extent' or one of its relatives: Cc'ing our\r
163 > resident invisibility guru.\r
164\r
165\r
166 > Peace\r
167\r
168 > -- \r
169 > Pieter\r
170 \r
171 \r
172 FYI, this bug has been fixed by Aaron Ecay [1], commit 8392a7cc, which\r
173 will be included in v0.12.  Not accompanied by a test, though, so keep\r
174 an eye out for regressions.\r
175 \r
176 Maybe the following might be of use to someone:\r
177 \r
178   #+begin_src sh\r
179     msg_lines=25\r
180     sh -c "stty rows 24 cols 80; \\r
181         emacs -Q -nw --eval \\r
182         '(progn\r
183             (dotimes (i ${msg_lines}) (insert \"\n\"))\r
184             (goto-char (point-min))\r
185             (scroll-up nil)\r
186             (princ (line-number-at-pos nil)))'"\r
187   #+end_src\r
188 \r
189 This correctly returns "20", but when running the exact same thing\r
190 with Emacs in batch mode (add '--batch' option), it returns "7" ?!?\r
191 \r
192 \r
193 Peace\r
194 \r
195 -- \r
196 Pieter\r
197 \r
198 [1] id:"1324563860-21986-1-git-send-email-aaronecay@gmail.com"\r