[PATCH] emacs: Cycle through notmuch buffers rather than jumping to the last.
authorDavid Edmondson <dme@dme.org>
Tue, 27 Dec 2011 10:50:44 +0000 (10:50 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:41:19 +0000 (09:41 -0800)
0c/24dbb573612c71d67e285854ed5c7e359db7e4 [new file with mode: 0644]

diff --git a/0c/24dbb573612c71d67e285854ed5c7e359db7e4 b/0c/24dbb573612c71d67e285854ed5c7e359db7e4
new file mode 100644 (file)
index 0000000..1512295
--- /dev/null
@@ -0,0 +1,115 @@
+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 66A49431FD0\r
+       for <notmuch@notmuchmail.org>; Tue, 27 Dec 2011 02:50:51 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 U5Dcz52ETxBG for <notmuch@notmuchmail.org>;\r
+       Tue, 27 Dec 2011 02:50:51 -0800 (PST)\r
+Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com\r
+ [74.125.82.41])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ CECFE431FB6   for <notmuch@notmuchmail.org>; Tue, 27 Dec 2011 02:50:50 -0800\r
+ (PST)\r
+Received: by wgbdt12 with SMTP id dt12so15459002wgb.2\r
+       for <notmuch@notmuchmail.org>; Tue, 27 Dec 2011 02:50:49 -0800 (PST)\r
+Received: by 10.216.139.94 with SMTP id b72mr15291838wej.38.1324983049606;\r
+       Tue, 27 Dec 2011 02:50:49 -0800 (PST)\r
+Received: from hotblack-desiato.hh.sledj.net\r
+       (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])\r
+       by mx.google.com with ESMTPS id fq7sm27588224wbb.1.2011.12.27.02.50.47\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Tue, 27 Dec 2011 02:50:48 -0800 (PST)\r
+Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
+       id 7DE93A04BC; Tue, 27 Dec 2011 10:50:46 +0000 (GMT)\r
+From: David Edmondson <dme@dme.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] emacs: Cycle through notmuch buffers rather than jumping to\r
+       the last.\r
+Date: Tue, 27 Dec 2011 10:50:44 +0000\r
+Message-Id: <1324983044-29249-1-git-send-email-dme@dme.org>\r
+X-Mailer: git-send-email 1.7.7.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: Tue, 27 Dec 2011 10:50:51 -0000\r
+\r
+As suggested by j4ni in #notmuch, rename\r
+`notmuch-jump-to-recent-buffer' as `notmuch-cycle-notmuch-buffers' and\r
+have it behave accordingly.\r
+---\r
+ emacs/notmuch.el |   39 +++++++++++++++++++++++++++------------\r
+ 1 files changed, 27 insertions(+), 12 deletions(-)\r
+\r
+diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
+index c678c93..4844385 100644\r
+--- a/emacs/notmuch.el\r
++++ b/emacs/notmuch.el\r
+@@ -1056,20 +1056,35 @@ current search results AND that are tagged with the given tag."\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
++(defun notmuch-cycle-notmuch-buffers ()\r
++  "Cycle through any existing notmuch buffers (search, show or hello).\r
\r
+-If no recent buffer is found, run `notmuch'."\r
++If the current buffer is the only notmuch buffer, bury it. If no\r
++notmuch buffers exist, run `notmuch'."\r
+   (interactive)\r
+-  (let ((last\r
+-       (loop for buffer in (buffer-list)\r
+-             if (with-current-buffer buffer\r
+-                  (memq major-mode '(notmuch-show-mode\r
+-                                     notmuch-search-mode\r
+-                                     notmuch-hello-mode)))\r
+-             return buffer)))\r
+-    (if last\r
+-      (switch-to-buffer last)\r
++\r
++  (let (start first)\r
++    ;; If the current buffer is a notmuch buffer, remember it and then\r
++    ;; bury it.\r
++    (when (memq major-mode '(notmuch-show-mode\r
++                           notmuch-search-mode\r
++                           notmuch-hello-mode))\r
++      (setq start (current-buffer))\r
++      (bury-buffer))\r
++\r
++    ;; Find the first notmuch buffer.\r
++    (setq first (loop for buffer in (buffer-list)\r
++                   if (with-current-buffer buffer\r
++                        (memq major-mode '(notmuch-show-mode\r
++                                           notmuch-search-mode\r
++                                           notmuch-hello-mode)))\r
++                   return buffer))\r
++\r
++    (if first\r
++      ;; If the first one we found is any other than the starting\r
++      ;; buffer, switch to it.\r
++      (unless (eq first start)\r
++        (switch-to-buffer first))\r
+       (notmuch))))\r
\r
+ (setq mail-user-agent 'notmuch-user-agent)\r
+-- \r
+1.7.7.3\r
+\r