From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 0E107431FD0 for ; Tue, 20 Dec 2011 00:01:53 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[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 4FA+XUQnYFFa for ; Tue, 20 Dec 2011 00:01:52 -0800 (PST) Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 5E33D431FB6 for ; Tue, 20 Dec 2011 00:01:52 -0800 (PST) Received: by werm12 with SMTP id m12so2321626wer.26 for ; Tue, 20 Dec 2011 00:01:51 -0800 (PST) Received: by 10.216.131.155 with SMTP id m27mr554033wei.19.1324368110967; Tue, 20 Dec 2011 00:01:50 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id eg7sm2280291wib.8.2011.12.20.00.01.49 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 20 Dec 2011 00:01:50 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 724FAA0179; Tue, 20 Dec 2011 08:01:48 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH v2] emacs: Add `notmuch-jump-to-recent-buffer'. Date: Tue, 20 Dec 2011 08:01:46 +0000 Message-Id: <1324368106-24802-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.7.3 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: Tue, 20 Dec 2011 08:01:53 -0000 >From a Carl Worth idea: add a function which will select the most recently used notmuch buffer (search, show or hello). If no recent buffer is found, run `notmuch'. It is expected that the user will global bind this command to a key sequence. --- emacs/notmuch.el | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index 2e9973e..da61aa9 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -1055,6 +1055,23 @@ current search results AND that are tagged with the given tag." (interactive) (notmuch-hello)) +;;;###autoload +(defun notmuch-jump-to-recent-buffer () + "Jump to the most recent notmuch buffer (search, show or hello). + +If no recent buffer is found, run `notmuch'." + (interactive) + (let ((last + (loop for buffer in (buffer-list) + if (with-current-buffer buffer + (memq major-mode '(notmuch-show-mode + notmuch-search-mode + notmuch-hello-mode))) + return buffer))) + (if last + (switch-to-buffer last) + (notmuch)))) + (setq mail-user-agent 'notmuch-user-agent) (provide 'notmuch) -- 1.7.7.3