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 E8E0A431E62
\r
6 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:30:56 -0800 (PST)
\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 VOPJpp-PDITe for <notmuch@notmuchmail.org>;
\r
16 Mon, 16 Jan 2012 02:30:46 -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 CC3E4431FC0
\r
21 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:30:45 -0800 (PST)
\r
22 Received: by werh12 with SMTP id h12so1290957wer.26
\r
23 for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 02:30:44 -0800 (PST)
\r
24 Received: by 10.216.138.148 with SMTP id a20mr3389412wej.15.1326709844649;
\r
25 Mon, 16 Jan 2012 02:30:44 -0800 (PST)
\r
26 Received: from localhost ([109.131.75.86])
\r
27 by mx.google.com with ESMTPS id l8sm18662987wiy.5.2012.01.16.02.30.43
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Mon, 16 Jan 2012 02:30:43 -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: <87r4z4lunp.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> <87r4z4lunp.fsf@praet.org>
\r
38 User-Agent: Notmuch/0.11+78~g6c58370 (http://notmuchmail.org) Emacs/23.3.1
\r
39 (x86_64-unknown-linux-gnu)
\r
40 Date: Mon, 16 Jan 2012 11:28:54 +0100
\r
41 Message-ID: <877h0s2b6h.fsf@praet.org>
\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
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: Mon, 16 Jan 2012 10:30:57 -0000
\r
59 On Thu, 12 Jan 2012 18:04:10 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
60 > On Wed, 16 Nov 2011 23:47:53 +0100, Pieter Praet <pieter@praet.org> wrote:
\r
61 > > On Sun, 13 Nov 2011 13:16:48 -0800, Jameson Graef Rollins <jrollins@finestructure.net> wrote:
\r
62 > > > This patch breaks out much of the functionality of
\r
63 > > > notmuch-show-advance-and-archive into a new function:
\r
64 > > > notmuch-show-advance. This new function does all the advancing
\r
65 > > > through a show buffer that notmuch-show-advance-and-archive did,
\r
66 > > > without all the invasive thread archiving. The return value of
\r
67 > > > notmuch-show-advance is nil if the bottom of the thread is not
\r
68 > > > reached, and t if it is.
\r
70 > > > notmuch-show-advance-and-archive is modified to just call
\r
71 > > > notmuch-show-advance, and then call notmuch-show-archive-thread if the
\r
72 > > > return value is true. In this way the previous functionality of
\r
73 > > > notmuch-show-advance-and-archive is preserved.
\r
75 > > > This provides a way for people to rebind the space bar to a more sane
\r
76 > > > function if they don't like the default behavior.
\r
78 > > > emacs/notmuch-show.el | 38 +++++++++++++++++++++++---------------
\r
79 > > > 1 files changed, 23 insertions(+), 15 deletions(-)
\r
81 > > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
82 > > > index d5c95d8..a7f3263 100644
\r
83 > > > --- a/emacs/notmuch-show.el
\r
84 > > > +++ b/emacs/notmuch-show.el
\r
85 > > > @@ -1135,26 +1135,18 @@ All currently available key bindings:
\r
87 > > > ;; Commands typically bound to keys.
\r
89 > > > -(defun notmuch-show-advance-and-archive ()
\r
90 > > > - "Advance through thread and archive.
\r
92 > > > -This command is intended to be one of the simplest ways to
\r
93 > > > -process a thread of email. It does the following:
\r
94 > > > +(defun notmuch-show-advance ()
\r
95 > > > + "Advance through thread.
\r
97 > > > If the current message in the thread is not yet fully visible,
\r
98 > > > scroll by a near screenful to read more of the message.
\r
100 > > > Otherwise, (the end of the current message is already within the
\r
101 > > > -current window), advance to the next open message.
\r
103 > > > -Finally, if there is no further message to advance to, and this
\r
104 > > > -last message is already read, then archive the entire current
\r
105 > > > -thread, (remove the \"inbox\" tag from each message). Also kill
\r
106 > > > -this buffer, and display the next thread from the search from
\r
107 > > > -which this thread was originally shown."
\r
108 > > > +current window), advance to the next open message."
\r
109 > > > (interactive)
\r
110 > > > (let* ((end-of-this-message (notmuch-show-message-bottom))
\r
111 > > > - (visible-end-of-this-message (1- end-of-this-message)))
\r
112 > > > + (visible-end-of-this-message (1- end-of-this-message))
\r
114 > > > (while (invisible-p visible-end-of-this-message)
\r
115 > > > (setq visible-end-of-this-message
\r
116 > > > (previous-single-char-property-change visible-end-of-this-message
\r
117 > > > @@ -1173,8 +1165,24 @@ which this thread was originally shown."
\r
118 > > > (notmuch-show-next-open-message))
\r
121 > > > - ;; This is the last message - archive the thread.
\r
122 > > > - (notmuch-show-archive-thread)))))
\r
123 > > > + ;; This is the last message - change the return value
\r
124 > > > + (setq ret t)))
\r
127 > > > +(defun notmuch-show-advance-and-archive ()
\r
128 > > > + "Advance through thread and archive.
\r
130 > > > +This command is intended to be one of the simplest ways to
\r
131 > > > +process a thread of email. It works exactly like
\r
132 > > > +notmuch-show-advance, in that it scrolls through messages in a
\r
133 > > > +show buffer, except that when it gets to the end of the buffer it
\r
134 > > > +archives the entire current thread, (remove the \"inbox\" tag
\r
135 > > > +from each message), kills the buffer, and displays the next
\r
136 > > > +thread from the search from which this thread was originally
\r
138 > > > + (interactive)
\r
139 > > > + (if (notmuch-show-advance)
\r
140 > > > + (notmuch-show-archive-thread)))
\r
142 > > > (defun notmuch-show-rewind ()
\r
143 > > > "Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]).
\r
147 > > > _______________________________________________
\r
148 > > > notmuch mailing list
\r
149 > > > notmuch@notmuchmail.org
\r
150 > > > http://notmuchmail.org/mailman/listinfo/notmuch
\r
155 > > Signed-off-by: Pieter Praet <pieter@praet.org> ;)
\r
158 > > This has also exposed a pre-existing bug: When the last visible message
\r
159 > > is longer than a screenful and contains a *hidden* signature, you'll
\r
160 > > never get to see the end of it.
\r
162 > > The culprit is presumably seeking shelter from the flyswatter @
\r
163 > > `notmuch-show-message-extent' or one of its relatives: Cc'ing our
\r
164 > > resident invisibility guru.
\r
173 > FYI, this bug has been fixed by Aaron Ecay [1], commit 8392a7cc, which
\r
174 > will be included in v0.12. Not accompanied by a test, though, so keep
\r
175 > an eye out for regressions.
\r
177 > Maybe the following might be of use to someone:
\r
181 > sh -c "stty rows 24 cols 80; \
\r
182 > emacs -Q -nw --eval \
\r
184 > (dotimes (i ${msg_lines}) (insert \"\n\"))
\r
185 > (goto-char (point-min))
\r
187 > (princ (line-number-at-pos nil)))'"
\r
190 > This correctly returns "20", but when running the exact same thing
\r
191 > with Emacs in batch mode (add '--batch' option), it returns "7" ?!?
\r
195 Minor clarification, in the unlikely event anyone's wondering:
\r
197 A result of "20" is correct because we have 24 lines of which 3 are
\r
198 lost to interface (mode line, echo area and menu bar are enabled by
\r
199 default), and another one is "lost" due to `scroll-up' moving point
\r
200 to the penultimate visible line.
\r
207 > [1] id:"1324563860-21986-1-git-send-email-aaronecay@gmail.com"
\r