--- /dev/null
+Return-Path: <jani@nikula.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 A3D75431FC0\r
+ for <notmuch@notmuchmail.org>; Sat, 25 May 2013 05:14:40 -0700 (PDT)\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 BXaIFYICpJWz for <notmuch@notmuchmail.org>;\r
+ Sat, 25 May 2013 05:14:35 -0700 (PDT)\r
+Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com\r
+ [209.85.217.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id EC048431FAE\r
+ for <notmuch@notmuchmail.org>; Sat, 25 May 2013 05:14:34 -0700 (PDT)\r
+Received: by mail-lb0-f175.google.com with SMTP id v10so5418781lbd.6\r
+ for <notmuch@notmuchmail.org>; Sat, 25 May 2013 05:14:33 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=google.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state;\r
+ bh=QpxUoUUwYPDGP0jq+OoVm3QqyOgw9TnoF6tpgn1JP9g=;\r
+ b=aCPpDAo++a3/LIvrUf/I+foFu3Vwfh0HWoCi7p+ADDcxVTVo3DQjHl191MvRKR5UF/\r
+ Hen3UqhZ40Rn+AZayV5bc5fKIuK31NWBzT7834yzvCdw5HvloQCzSrc6i7cVzxVRka6r\r
+ ccmKGubMGO1hEL1g7aDBCOKOtjwQ7/FlkmnPfj8asKZtgtnWXh77lI33iQcz/KGQ3Ulb\r
+ nXe4ly0spAIMEkLAV8Grq5zr8v204FltwIFzm8wWHaQxX71IIP1rQrsZV+BgLLPJuqZO\r
+ yqTwPt4lV/DYShbb9VRULfGsrkR0DQDooz+5mBMaW7DzD/lB36RJfiBWDiY4blnafuJg\r
+ H9mA==\r
+X-Received: by 10.112.6.6 with SMTP id w6mr10674028lbw.123.1369484073512;\r
+ Sat, 25 May 2013 05:14:33 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw2-58c376-211.dhcp.inet.fi.\r
+ [88.195.118.211])\r
+ by mx.google.com with ESMTPSA id a3sm2066492lbg.2.2013.05.25.05.14.31\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Sat, 25 May 2013 05:14:32 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 1/2] emacs: add show view bindings to move to previous/next\r
+ thread\r
+Date: Sat, 25 May 2013 15:14:25 +0300\r
+Message-Id: <1369484066-20228-1-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 1.7.10.4\r
+X-Gm-Message-State:\r
+ ALoCoQluMlsR7kGShc9ari8IneeLsJQv4cmLpuC6qyHBzlEBygn7Uy7J/m8vlZ+WzSUblhRIKMHr\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\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 12:14:40 -0000\r
+\r
+We have most of the plumbing in place, add the bindings M-n and M-p.\r
+\r
+---\r
+\r
+v2: reduce duplication by adding PREVIOUS argument to\r
+ notmuch-show-next-thread instead of adding a separate function for\r
+ moving to previous thread (Mark)\r
+---\r
+ emacs/notmuch-show.el | 28 ++++++++++++++++++++++++----\r
+ 1 file changed, 24 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index d56154e..a903395 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,17 +1837,34 @@ 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
++ (if previous\r
++ (notmuch-search-previous-thread)\r
++ (notmuch-search-next-thread))\r
++ (if 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
+-- \r
+1.7.10.4\r
+\r