Re: [PATCH] emacs: breakout notmuch-show-advance functionality from notmuch-show...
authorPieter Praet <pieter@praet.org>
Wed, 16 Nov 2011 22:47:53 +0000 (23:47 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:15 +0000 (09:40 -0800)
cd/62b38b71cb3581649ee8b9789c83c97105dc68 [new file with mode: 0644]

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