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