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 788504196F2 for ; Thu, 22 Apr 2010 04:20:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham 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 dHwulUvdu0qB for ; Thu, 22 Apr 2010 04:20:25 -0700 (PDT) Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com [74.125.82.181]) by olra.theworths.org (Postfix) with ESMTP id D9FF4431FC1 for ; Thu, 22 Apr 2010 04:20:24 -0700 (PDT) Received: by wyf23 with SMTP id 23so617419wyf.26 for ; Thu, 22 Apr 2010 04:20:24 -0700 (PDT) Received: by 10.216.160.132 with SMTP id u4mr8485268wek.19.1271935222800; Thu, 22 Apr 2010 04:20:22 -0700 (PDT) Received: from ut.hh.sledj.net (gmp-ea-fw-1.sun.com [192.18.1.36]) by mx.google.com with ESMTPS id x14sm74956795wbs.6.2010.04.22.04.20.21 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 22 Apr 2010 04:20:22 -0700 (PDT) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id 73D78594163; Thu, 22 Apr 2010 12:20:21 +0100 (BST) From: David Edmondson 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 Message-Id: <1271935216-14692-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.0 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, 22 Apr 2010 11:20:28 -0000 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