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 66298429E25 for ; Thu, 12 Jan 2012 09:05:55 -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 T9p4aUI+tOKX for ; Thu, 12 Jan 2012 09:05:51 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 7CB00431FB6 for ; Thu, 12 Jan 2012 09:05:51 -0800 (PST) Received: by werm12 with SMTP id m12so1789752wer.26 for ; Thu, 12 Jan 2012 09:05:50 -0800 (PST) Received: by 10.216.133.234 with SMTP id q84mr1931850wei.30.1326387950175; Thu, 12 Jan 2012 09:05:50 -0800 (PST) Received: from localhost ([109.131.126.209]) by mx.google.com with ESMTPS id gf8sm6440966wbb.11.2012.01.12.09.05.48 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 Jan 2012 09:05:49 -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: <87r517bs6e.fsf@praet.org> References: <1321219008-11690-1-git-send-email-jrollins@finestructure.net> <1321219008-11690-2-git-send-email-jrollins@finestructure.net> <87r517bs6e.fsf@praet.org> User-Agent: Notmuch/0.10.2+115~gadd29f6 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-unknown-linux-gnu) Date: Thu, 12 Jan 2012 18:04:10 +0100 Message-ID: <87r4z4lunp.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: Thu, 12 Jan 2012 17:05:55 -0000 On Wed, 16 Nov 2011 23:47:53 +0100, Pieter Praet wrote: > 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 FYI, this bug has been fixed by Aaron Ecay [1], commit 8392a7cc, which will be included in v0.12. Not accompanied by a test, though, so keep an eye out for regressions. Maybe the following might be of use to someone: #+begin_src sh msg_lines=25 sh -c "stty rows 24 cols 80; \ emacs -Q -nw --eval \ '(progn (dotimes (i ${msg_lines}) (insert \"\n\")) (goto-char (point-min)) (scroll-up nil) (princ (line-number-at-pos nil)))'" #+end_src This correctly returns "20", but when running the exact same thing with Emacs in batch mode (add '--batch' option), it returns "7" ?!? Peace -- Pieter [1] id:"1324563860-21986-1-git-send-email-aaronecay@gmail.com"