--- /dev/null
+Return-Path: <dme@dme.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 8DB5340DF1C\r
+ for <notmuch@notmuchmail.org>; Mon, 22 Nov 2010 03:54:47 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.9\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
+ tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham\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 Ou7fOGISRO50 for <notmuch@notmuchmail.org>;\r
+ Mon, 22 Nov 2010 03:54:37 -0800 (PST)\r
+Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
+ [74.125.82.181])\r
+ by olra.theworths.org (Postfix) with ESMTP id 430EE40DF1B\r
+ for <notmuch@notmuchmail.org>; Mon, 22 Nov 2010 03:54:37 -0800 (PST)\r
+Received: by wyb36 with SMTP id 36so2377312wyb.26\r
+ for <notmuch@notmuchmail.org>; Mon, 22 Nov 2010 03:54:36 -0800 (PST)\r
+Received: by 10.216.180.85 with SMTP id i63mr735989wem.53.1290426874783;\r
+ Mon, 22 Nov 2010 03:54:34 -0800 (PST)\r
+Received: from ut.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com\r
+ [81.149.164.25])\r
+ by mx.google.com with ESMTPS id x3sm2222809wes.22.2010.11.22.03.54.33\r
+ (version=TLSv1/SSLv3 cipher=RC4-MD5);\r
+ Mon, 22 Nov 2010 03:54:34 -0800 (PST)\r
+Received: by ut.hh.sledj.net (Postfix, from userid 1000)\r
+ id 265E0594058; Mon, 22 Nov 2010 11:51:06 +0000 (GMT)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Add `notmuch-jump-to-recent-buffer'.\r
+Date: Mon, 22 Nov 2010 11:51:04 +0000\r
+Message-Id: <1290426664-15745-1-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.2.3\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: Mon, 22 Nov 2010 11:54:47 -0000\r
+\r
+>From a Carl Worth idea: Add `notmuch-jump-to-recent-buffer', which\r
+will select the most recently used notmuch buffer (search, show or\r
+hello). If no recent buffer is found, run `notmuch'.\r
+\r
+It is expected that the user will global bind this command to a key\r
+sequence.\r
+---\r
+ emacs/notmuch.el | 18 ++++++++++++++++++\r
+ 1 files changed, 18 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index e8d4d98..67271d1 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -962,6 +962,24 @@ current search results AND that are tagged with the given tag."\r
+ (interactive)\r
+ (notmuch-hello))\r
+ \r
++;;;###autoload\r
++(defun notmuch-jump-to-recent-buffer ()\r
++ "Jump to the most recent notmuch buffer (search, show or hello).\r
++\r
++If no recent buffer is found, run `notmuch'."\r
++ (interactive)\r
++ (let ((last\r
++ (loop for buffer in (buffer-list)\r
++ if (progn\r
++ (set-buffer buffer)\r
++ (or (eq major-mode 'notmuch-show-mode)\r
++ (eq major-mode 'notmuch-search-mode)\r
++ (eq major-mode 'notmuch-hello-mode)))\r
++ return buffer)))\r
++ (if last\r
++ (switch-to-buffer last)\r
++ (notmuch))))\r
++\r
+ (setq mail-user-agent 'notmuch-user-agent)\r
+ \r
+ (provide 'notmuch)\r
+-- \r
+1.7.2.3\r
+\r