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 8DB5340DF1C for ; Mon, 22 Nov 2010 03:54:47 -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, RCVD_IN_DNSWL_NONE=-0.0001] 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 Ou7fOGISRO50 for ; Mon, 22 Nov 2010 03:54:37 -0800 (PST) Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com [74.125.82.181]) by olra.theworths.org (Postfix) with ESMTP id 430EE40DF1B for ; Mon, 22 Nov 2010 03:54:37 -0800 (PST) Received: by wyb36 with SMTP id 36so2377312wyb.26 for ; Mon, 22 Nov 2010 03:54:36 -0800 (PST) Received: by 10.216.180.85 with SMTP id i63mr735989wem.53.1290426874783; Mon, 22 Nov 2010 03:54:34 -0800 (PST) Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com [81.149.164.25]) by mx.google.com with ESMTPS id x3sm2222809wes.22.2010.11.22.03.54.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 22 Nov 2010 03:54:34 -0800 (PST) Received: by ut.hh.sledj.net (Postfix, from userid 1000) id 265E0594058; Mon, 22 Nov 2010 11:51:06 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Add `notmuch-jump-to-recent-buffer'. Date: Mon, 22 Nov 2010 11:51:04 +0000 Message-Id: <1290426664-15745-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.2.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: Mon, 22 Nov 2010 11:54:47 -0000 >From a Carl Worth idea: Add `notmuch-jump-to-recent-buffer', 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 | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index e8d4d98..67271d1 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -962,6 +962,24 @@ 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 (progn + (set-buffer buffer) + (or (eq major-mode 'notmuch-show-mode) + (eq major-mode 'notmuch-search-mode) + (eq major-mode 'notmuch-hello-mode))) + return buffer))) + (if last + (switch-to-buffer last) + (notmuch)))) + (setq mail-user-agent 'notmuch-user-agent) (provide 'notmuch) -- 1.7.2.3