Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 82EC2429E21 for ; Wed, 16 Nov 2011 14:48:56 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CqoM+wSI44-g for ; Wed, 16 Nov 2011 14:48:54 -0800 (PST) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id F409D431FD0 for ; Wed, 16 Nov 2011 14:48:53 -0800 (PST) Received: by wwf10 with SMTP id 10so1374802wwf.2 for ; Wed, 16 Nov 2011 14:48:53 -0800 (PST) Received: by 10.227.208.147 with SMTP id gc19mr24011191wbb.25.1321483732903; Wed, 16 Nov 2011 14:48:52 -0800 (PST) Received: from localhost ([109.131.148.49]) by mx.google.com with ESMTPS id gd6sm34442953wbb.1.2011.11.16.14.48.51 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 16 Nov 2011 14:48:51 -0800 (PST) From: Pieter Praet To: Jameson Graef Rollins Subject: Re: [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show-advance-and-archive In-Reply-To: <1321219008-11690-2-git-send-email-jrollins@finestructure.net> References: <1321219008-11690-1-git-send-email-jrollins@finestructure.net> <1321219008-11690-2-git-send-email-jrollins@finestructure.net> User-Agent: Notmuch/0.9+76~g2fd88e6 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-unknown-linux-gnu) Date: Wed, 16 Nov 2011 23:47:53 +0100 Message-ID: <87r517bs6e.fsf@praet.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Notmuch Mail X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 22:48:56 -0000 On Sun, 13 Nov 2011 13:16:48 -0800, Jameson Graef Rollins wrote: > This patch breaks out much of the functionality of > notmuch-show-advance-and-archive into a new function: > notmuch-show-advance. This new function does all the advancing > through a show buffer that notmuch-show-advance-and-archive did, > without all the invasive thread archiving. The return value of > notmuch-show-advance is nil if the bottom of the thread is not > reached, and t if it is. > > notmuch-show-advance-and-archive is modified to just call > notmuch-show-advance, and then call notmuch-show-archive-thread if the > return value is true. In this way the previous functionality of > notmuch-show-advance-and-archive is preserved. > > This provides a way for people to rebind the space bar to a more sane > function if they don't like the default behavior. > --- > emacs/notmuch-show.el | 38 +++++++++++++++++++++++--------------- > 1 files changed, 23 insertions(+), 15 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index d5c95d8..a7f3263 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -1135,26 +1135,18 @@ All currently available key bindings: > > ;; Commands typically bound to keys. > > -(defun notmuch-show-advance-and-archive () > - "Advance through thread and archive. > - > -This command is intended to be one of the simplest ways to > -process a thread of email. It does the following: > +(defun notmuch-show-advance () > + "Advance through thread. > > If the current message in the thread is not yet fully visible, > scroll by a near screenful to read more of the message. > > Otherwise, (the end of the current message is already within the > -current window), advance to the next open message. > - > -Finally, if there is no further message to advance to, and this > -last message is already read, then archive the entire current > -thread, (remove the \"inbox\" tag from each message). Also kill > -this buffer, and display the next thread from the search from > -which this thread was originally shown." > +current window), advance to the next open message." > (interactive) > (let* ((end-of-this-message (notmuch-show-message-bottom)) > - (visible-end-of-this-message (1- end-of-this-message))) > + (visible-end-of-this-message (1- end-of-this-message)) > + (ret nil)) > (while (invisible-p visible-end-of-this-message) > (setq visible-end-of-this-message > (previous-single-char-property-change visible-end-of-this-message > @@ -1173,8 +1165,24 @@ which this thread was originally shown." > (notmuch-show-next-open-message)) > > (t > - ;; This is the last message - archive the thread. > - (notmuch-show-archive-thread))))) > + ;; This is the last message - change the return value > + (setq ret t))) > + ret)) > + > +(defun notmuch-show-advance-and-archive () > + "Advance through thread and archive. > + > +This command is intended to be one of the simplest ways to > +process a thread of email. It works exactly like > +notmuch-show-advance, in that it scrolls through messages in a > +show buffer, except that when it gets to the end of the buffer it > +archives the entire current thread, (remove the \"inbox\" tag > +from each message), kills the buffer, and displays the next > +thread from the search from which this thread was originally > +shown." > + (interactive) > + (if (notmuch-show-advance) > + (notmuch-show-archive-thread))) > > (defun notmuch-show-rewind () > "Backup through the thread, (reverse scrolling compared to \\[notmuch-show-advance-and-archive]). > -- > 1.7.7.1 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch Nice one! Signed-off-by: Pieter Praet ;) This has also exposed a pre-existing bug: When the last visible message is longer than a screenful and contains a *hidden* signature, you'll never get to see the end of it. The culprit is presumably seeking shelter from the flyswatter @ `notmuch-show-message-extent' or one of its relatives: Cc'ing our resident invisibility guru. Peace -- Pieter