--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 0CA04431FC0\r
+ for <notmuch@notmuchmail.org>; Sat, 25 May 2013 14:13:58 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ 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 YJQy2YfHFowM for <notmuch@notmuchmail.org>;\r
+ Sat, 25 May 2013 14:13:50 -0700 (PDT)\r
+Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com\r
+ [209.85.212.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 842DC431FAF\r
+ for <notmuch@notmuchmail.org>; Sat, 25 May 2013 14:13:50 -0700 (PDT)\r
+Received: by mail-wi0-f175.google.com with SMTP id hn14so602461wib.14\r
+ for <notmuch@notmuchmail.org>; Sat, 25 May 2013 14:13:48 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=LCryKNpKVZf+/D5yGSkmx2/9rmOsUrquIxXUP/gqt3o=;\r
+ b=PY7ulkWhYdtAd0fBOSKJaaerIeToiuNilDYkTEabv5No6Oc7ItcPBWl8jP4GYtES2k\r
+ UFX01Z+2C2+IohpfiwwpVrrq50KLvyIG8q9HM4cxojGvGfskXrNSntkJleGAj6wBbVPO\r
+ IyzHucBTusAhRUlP3fPUpdEZ1eDT0IfWuKpkfXBw/g5/efmB8eZY02db+n+dDLs75IwF\r
+ TxvYBJZ8kxaZZmPEPOMHHIuYDjXaafDED9aKgAAfFQLCk0Mfvz5NV/rBJ2Zg5E9VfpGW\r
+ 4qjBjJ6x2nAN8BF0LoDKJOCNLbYPtPRxpUnhWVC/colsp1GFuFOoICOG6lL86Z4hTIKt\r
+ 3XRQ==\r
+X-Received: by 10.180.126.101 with SMTP id mx5mr3226289wib.48.1369516427937;\r
+ Sat, 25 May 2013 14:13:47 -0700 (PDT)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+ by mx.google.com with ESMTPSA id m3sm7384625wij.5.2013.05.25.14.13.46\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sat, 25 May 2013 14:13:47 -0700 (PDT)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: add show view bindings to move to previous/next thread\r
+Date: Sat, 25 May 2013 22:13:30 +0100\r
+Message-Id: <1369516410-24860-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <1369484066-20228-1-git-send-email-jani@nikula.org>\r
+References: <1369484066-20228-1-git-send-email-jani@nikula.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: Sat, 25 May 2013 21:13:58 -0000\r
+\r
+From: Jani Nikula <jani@nikula.org>\r
+\r
+We have most of the plumbing in place, add the bindings M-n and M-p.\r
+---\r
+ emacs/notmuch-show.el | 30 +++++++++++++++++++++++++-----\r
+ 1 files changed, 25 insertions(+), 5 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index d56154e..2b33007 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -39,6 +39,7 @@\r
+ \r
+ (declare-function notmuch-call-notmuch-process "notmuch" (&rest args))\r
+ (declare-function notmuch-search-next-thread "notmuch" nil)\r
++(declare-function notmuch-search-previous-thread "notmuch" nil)\r
+ (declare-function notmuch-search-show-thread "notmuch" nil)\r
+ \r
+ (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")\r
+@@ -1273,6 +1274,8 @@ reset based on the original query."\r
+ (define-key map "P" 'notmuch-show-previous-message)\r
+ (define-key map "n" 'notmuch-show-next-open-message)\r
+ (define-key map "p" 'notmuch-show-previous-open-message)\r
++ (define-key map (kbd "M-n") 'notmuch-show-next-thread-show)\r
++ (define-key map (kbd "M-p") 'notmuch-show-previous-thread-show)\r
+ (define-key map (kbd "DEL") 'notmuch-show-rewind)\r
+ (define-key map " " 'notmuch-show-advance-and-archive)\r
+ (define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)\r
+@@ -1834,16 +1837,33 @@ argument, hide all of the messages."\r
+ (interactive)\r
+ (backward-button 1))\r
+ \r
+-(defun notmuch-show-next-thread (&optional show-next)\r
+- "Move to the next item in the search results, if any."\r
++(defun notmuch-show-next-thread (&optional show previous)\r
++ "Move to the next item in the search results, if any.\r
++\r
++If SHOW is non-nil, open the next item in a show\r
++buffer. Otherwise just highlight the next item in the search\r
++buffer. If PREVIOUS is non-nil, move to the previous item in the\r
++search results instead."\r
+ (interactive "P")\r
+ (let ((parent-buffer notmuch-show-parent-buffer))\r
+ (notmuch-kill-this-buffer)\r
+ (when (buffer-live-p parent-buffer)\r
+ (switch-to-buffer parent-buffer)\r
+- (notmuch-search-next-thread)\r
+- (if show-next\r
+- (notmuch-search-show-thread)))))\r
++ (and (if previous\r
++ (notmuch-search-previous-thread)\r
++ (notmuch-search-next-thread))\r
++ show\r
++ (notmuch-search-show-thread)))))\r
++\r
++(defun notmuch-show-next-thread-show ()\r
++ "Show the next thread in the search results, if any."\r
++ (interactive)\r
++ (notmuch-show-next-thread t))\r
++\r
++(defun notmuch-show-previous-thread-show ()\r
++ "Show the previous thread in the search results, if any."\r
++ (interactive)\r
++ (notmuch-show-next-thread t t))\r
+ \r
+ (defun notmuch-show-archive-thread (&optional unarchive)\r
+ "Archive each message in thread.\r
+-- \r
+1.7.9.1\r
+\r