unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Edmondson <dme@dme.org>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs: Push the cursor to point-max on `n' or `N' at the end of a thread
Date: Thu, 22 Apr 2010 12:20:16 +0100	[thread overview]
Message-ID: <1271935216-14692-1-git-send-email-dme@dme.org> (raw)

Sebastian pointed out that the pre-JSON UI would move the cursor to
the end of the buffer if `n' or `N' is hit when on the last (unread)
message. Mimic that behaviour in the new UI.
---
 emacs/notmuch-show.el |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 379e344..d01bf36 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -816,9 +816,11 @@ any effects from previous calls to
 (defun notmuch-show-next-message ()
   "Show the next message."
   (interactive)
-  (notmuch-show-goto-message-next)
-  (notmuch-show-mark-read)
-  (notmuch-show-message-adjust))
+  (if (notmuch-show-goto-message-next)
+      (progn
+	(notmuch-show-mark-read)
+	(notmuch-show-message-adjust))
+    (goto-char (point-max))))
 
 (defun notmuch-show-previous-message ()
   "Show the previous message."
@@ -830,10 +832,14 @@ any effects from previous calls to
 (defun notmuch-show-next-open-message ()
   "Show the next message."
   (interactive)
-  (while (and (notmuch-show-goto-message-next)
-	      (not (notmuch-show-message-visible-p))))
-  (notmuch-show-mark-read)
-  (notmuch-show-message-adjust))
+  (let (r)
+    (while (and (setq r (notmuch-show-goto-message-next))
+		(not (notmuch-show-message-visible-p))))
+    (if r
+	(progn
+	  (notmuch-show-mark-read)
+	  (notmuch-show-message-adjust))
+      (goto-char (point-max)))))
 
 (defun notmuch-show-previous-open-message ()
   "Show the previous message."
-- 
1.7.0

             reply	other threads:[~2010-04-22 11:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-22 11:20 David Edmondson [this message]
2010-04-23 20:27 ` [PATCH] emacs: Push the cursor to point-max on `n' or `N' at the end of a thread Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1271935216-14692-1-git-send-email-dme@dme.org \
    --to=dme@dme.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).