unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Make moving to the previous message move to the previous boundary
@ 2012-07-14  3:47 Austin Clements
  2012-07-18 21:54 ` Mark Walters
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Austin Clements @ 2012-07-14  3:47 UTC (permalink / raw)
  To: notmuch

Previously, notmuch-show-previous-message would move to the beginning
of the message before the message containing point.  This patch makes
it instead move to the previous message *boundary*.  That is, if point
isn't already at the beginning of the message, it moves to the
beginning of the current message.  This is consistent with
notmuch-show-next-message, which can be thought of as moving to the
next message boundary.  Several people have expressed a preference for
this.
---

This patch accompanies the series in [0] (though they're independent
and can be applied in either order).  This makes the behavior of 'p'
and 'P' in show-mode conceptually similar to the new behavior of 'p'
in search-mode.

[0] 1342140319-19859-1-git-send-email-amdragon@mit.edu

 emacs/notmuch-show.el |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 6335d45..02e319f 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1525,9 +1525,11 @@ thread, navigate to the next thread in the parent search buffer."
       (goto-char (point-max)))))
 
 (defun notmuch-show-previous-message ()
-  "Show the previous message."
+  "Show the previous message or the start of the current message."
   (interactive)
-  (notmuch-show-goto-message-previous)
+  (if (= (point) (notmuch-show-message-top))
+      (notmuch-show-goto-message-previous)
+    (notmuch-show-move-to-message-top))
   (notmuch-show-mark-read)
   (notmuch-show-message-adjust))
 
@@ -1587,7 +1589,9 @@ to show, nil otherwise."
 (defun notmuch-show-previous-open-message ()
   "Show the previous open message."
   (interactive)
-  (while (and (notmuch-show-goto-message-previous)
+  (while (and (if (= (point) (notmuch-show-message-top))
+		  (notmuch-show-goto-message-previous)
+		(notmuch-show-move-to-message-top))
 	      (not (notmuch-show-message-visible-p))))
   (notmuch-show-mark-read)
   (notmuch-show-message-adjust))
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] emacs: Make moving to the previous message move to the previous boundary
  2012-07-14  3:47 [PATCH] emacs: Make moving to the previous message move to the previous boundary Austin Clements
@ 2012-07-18 21:54 ` Mark Walters
  2012-08-06 14:29 ` Tomi Ollila
  2012-08-12 19:56 ` David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Walters @ 2012-07-18 21:54 UTC (permalink / raw)
  To: Austin Clements, notmuch

On Sat, 14 Jul 2012, Austin Clements <amdragon@MIT.EDU> wrote:
> Previously, notmuch-show-previous-message would move to the beginning
> of the message before the message containing point.  This patch makes
> it instead move to the previous message *boundary*.  That is, if point
> isn't already at the beginning of the message, it moves to the
> beginning of the current message.  This is consistent with
> notmuch-show-next-message, which can be thought of as moving to the
> next message boundary.  Several people have expressed a preference for
> this.

I like this change: the current behaviour has mildly confused/annoyed me
in the past.

>
> This patch accompanies the series in [0] (though they're independent
> and can be applied in either order).  This makes the behavior of 'p'
> and 'P' in show-mode conceptually similar to the new behavior of 'p'
> in search-mode.
>
> [0] 1342140319-19859-1-git-send-email-amdragon@mit.edu
>
>  emacs/notmuch-show.el |   10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 6335d45..02e319f 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1525,9 +1525,11 @@ thread, navigate to the next thread in the parent search buffer."
>        (goto-char (point-max)))))
>  
>  (defun notmuch-show-previous-message ()
> -  "Show the previous message."
> +  "Show the previous message or the start of the current message."
>    (interactive)
> -  (notmuch-show-goto-message-previous)
> +  (if (= (point) (notmuch-show-message-top))
> +      (notmuch-show-goto-message-previous)
> +    (notmuch-show-move-to-message-top))
>    (notmuch-show-mark-read)
>    (notmuch-show-message-adjust))
>  
> @@ -1587,7 +1589,9 @@ to show, nil otherwise."
>  (defun notmuch-show-previous-open-message ()
>    "Show the previous open message."
>    (interactive)
> -  (while (and (notmuch-show-goto-message-previous)
> +  (while (and (if (= (point) (notmuch-show-message-top))
> +		  (notmuch-show-goto-message-previous)
> +		(notmuch-show-move-to-message-top))
>  	      (not (notmuch-show-message-visible-p))))
>    (notmuch-show-mark-read)
>    (notmuch-show-message-adjust))

I would mildly prefer taking the testing for top of message out of the
loop (I know it's one line longer) as

  (if (= (point) (notmuch-show-message-top))
      (notmuch-show-goto-message-previous)
    (notmuch-show-move-to-message-top))
  (while (and (not (notmuch-show-message-visible-p))
	      (notmuch-show-goto-message-previous)))

but its obviously fine as is.

Best wishes

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] emacs: Make moving to the previous message move to the previous boundary
  2012-07-14  3:47 [PATCH] emacs: Make moving to the previous message move to the previous boundary Austin Clements
  2012-07-18 21:54 ` Mark Walters
@ 2012-08-06 14:29 ` Tomi Ollila
  2012-08-12 19:56 ` David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2012-08-06 14:29 UTC (permalink / raw)
  To: Austin Clements, notmuch

On Sat, Jul 14 2012, Austin Clements <amdragon@MIT.EDU> wrote:

> Previously, notmuch-show-previous-message would move to the beginning
> of the message before the message containing point.  This patch makes
> it instead move to the previous message *boundary*.  That is, if point
> isn't already at the beginning of the message, it moves to the
> beginning of the current message.  This is consistent with
> notmuch-show-next-message, which can be thought of as moving to the
> next message boundary.  Several people have expressed a preference for
> this.
> ---

LGTM. Contrary to what I wrote in id:"m2pq746tlq.fsf@guru.guru-group.fi"
I think this could be pushed...

Tomi

> This patch accompanies the series in [0] (though they're independent
> and can be applied in either order).  This makes the behavior of 'p'
> and 'P' in show-mode conceptually similar to the new behavior of 'p'
> in search-mode.
>
> [0] 1342140319-19859-1-git-send-email-amdragon@mit.edu
>
>  emacs/notmuch-show.el |   10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 6335d45..02e319f 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1525,9 +1525,11 @@ thread, navigate to the next thread in the parent search buffer."
>        (goto-char (point-max)))))
>  
>  (defun notmuch-show-previous-message ()
> -  "Show the previous message."
> +  "Show the previous message or the start of the current message."
>    (interactive)
> -  (notmuch-show-goto-message-previous)
> +  (if (= (point) (notmuch-show-message-top))
> +      (notmuch-show-goto-message-previous)
> +    (notmuch-show-move-to-message-top))
>    (notmuch-show-mark-read)
>    (notmuch-show-message-adjust))
>  
> @@ -1587,7 +1589,9 @@ to show, nil otherwise."
>  (defun notmuch-show-previous-open-message ()
>    "Show the previous open message."
>    (interactive)
> -  (while (and (notmuch-show-goto-message-previous)
> +  (while (and (if (= (point) (notmuch-show-message-top))
> +		  (notmuch-show-goto-message-previous)
> +		(notmuch-show-move-to-message-top))
>  	      (not (notmuch-show-message-visible-p))))
>    (notmuch-show-mark-read)
>    (notmuch-show-message-adjust))
> -- 
> 1.7.10
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] emacs: Make moving to the previous message move to the previous boundary
  2012-07-14  3:47 [PATCH] emacs: Make moving to the previous message move to the previous boundary Austin Clements
  2012-07-18 21:54 ` Mark Walters
  2012-08-06 14:29 ` Tomi Ollila
@ 2012-08-12 19:56 ` David Bremner
  2 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2012-08-12 19:56 UTC (permalink / raw)
  To: Austin Clements, notmuch

Austin Clements <amdragon@MIT.EDU> writes:

> Previously, notmuch-show-previous-message would move to the beginning
> of the message before the message containing point.  This patch makes
> it instead move to the previous message *boundary*.

pushed, 

d

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-12 19:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-14  3:47 [PATCH] emacs: Make moving to the previous message move to the previous boundary Austin Clements
2012-07-18 21:54 ` Mark Walters
2012-08-06 14:29 ` Tomi Ollila
2012-08-12 19:56 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).