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 7418240DDF9 for ; Sun, 14 Nov 2010 14:16:46 -0800 (PST) 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 gnWaTY8KED9f for ; Sun, 14 Nov 2010 14:16:36 -0800 (PST) Received: from tarap.cc.columbia.edu (tarap.cc.columbia.edu [128.59.29.7]) by olra.theworths.org (Postfix) with ESMTP id 4A7BE40DDCF for ; Sun, 14 Nov 2010 14:16:36 -0800 (PST) Received: from servo.finestructure.net (cpe-74-66-82-137.nyc.res.rr.com [74.66.82.137]) (user=jgr2110 author=jrollins@finestructure.net mech=PLAIN bits=0) by tarap.cc.columbia.edu (8.14.4/8.14.3) with ESMTP id oAEMGYHT001324 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT) for ; Sun, 14 Nov 2010 17:16:35 -0500 (EST) Received: from jrollins by servo.finestructure.net with local (Exim 4.72) (envelope-from ) id 1PHksE-0004hL-8X for notmuch@notmuchmail.org; Sun, 14 Nov 2010 17:16:34 -0500 From: Jameson Rollins To: Notmuch Mail Subject: [PATCH] emacs: add some convenience functions to show mode Date: Sun, 14 Nov 2010 17:09:01 -0500 Message-ID: <87zktbeekd.fsf@servo.finestructure.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-No-Spam-Score: Local X-Scanned-By: MIMEDefang 2.68 on 128.59.29.7 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: Sun, 14 Nov 2010 22:16:46 -0000 Adding three new conveneince functions: notmuch-show-next-open-message-or-pop notmuch-show-next-thread notmuch-show-previous-thread While these are not currently bound to any keys, I have found them to be very useful for constructing custom key bindings outside of what notmuch provides by default. For example: (define-key notmuch-show-mode-map "a" (lambda () "archive current message and advance" (interactive) (notmuch-show-remove-tag "inbox") (notmuch-show-next-open-message-or-pop))) (define-key notmuch-show-mode-map "N" 'notmuch-show-next-thread) (define-key notmuch-show-mode-map "P" 'notmuch-show-previous-thread) --- emacs/notmuch-show.el | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index b89b685..820fd0e 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -920,6 +920,45 @@ any effects from previous calls to (notmuch-show-mark-read) (notmuch-show-message-adjust)) +(defun notmuch-show-next-open-message-or-pop () + "Show the next message or pop out if none remain." + (interactive) + (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)) + (let ((parent-buffer notmuch-show-parent-buffer)) + (if parent-buffer + (progn + (kill-this-buffer) + (switch-to-buffer parent-buffer) + (forward-line 1))))))) + +(defun notmuch-show-next-thread () + "Move to the next thread from the last search." + (interactive) + (let ((parent-buffer notmuch-show-parent-buffer)) + (if parent-buffer + (progn + (kill-this-buffer) + (switch-to-buffer parent-buffer) + (forward-line 1) + (notmuch-search-show-thread))))) + +(defun notmuch-show-previous-thread () + "Move to the previous thread from the last search." + (interactive) + (let ((parent-buffer notmuch-show-parent-buffer)) + (if parent-buffer + (progn + (kill-this-buffer) + (switch-to-buffer parent-buffer) + (forward-line -1) + (notmuch-search-show-thread))))) + (defun notmuch-show-view-raw-message () "View the file holding the current message." (interactive) -- 1.7.2.3