1 Return-Path: <dme@dme.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 66A49431FD0
\r
6 for <notmuch@notmuchmail.org>; Tue, 27 Dec 2011 02:50:51 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id U5Dcz52ETxBG for <notmuch@notmuchmail.org>;
\r
16 Tue, 27 Dec 2011 02:50:51 -0800 (PST)
\r
17 Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com
\r
18 [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 CECFE431FB6 for <notmuch@notmuchmail.org>; Tue, 27 Dec 2011 02:50:50 -0800
\r
22 Received: by wgbdt12 with SMTP id dt12so15459002wgb.2
\r
23 for <notmuch@notmuchmail.org>; Tue, 27 Dec 2011 02:50:49 -0800 (PST)
\r
24 Received: by 10.216.139.94 with SMTP id b72mr15291838wej.38.1324983049606;
\r
25 Tue, 27 Dec 2011 02:50:49 -0800 (PST)
\r
26 Received: from hotblack-desiato.hh.sledj.net
\r
27 (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25])
\r
28 by mx.google.com with ESMTPS id fq7sm27588224wbb.1.2011.12.27.02.50.47
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Tue, 27 Dec 2011 02:50:48 -0800 (PST)
\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
32 id 7DE93A04BC; Tue, 27 Dec 2011 10:50:46 +0000 (GMT)
\r
33 From: David Edmondson <dme@dme.org>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH] emacs: Cycle through notmuch buffers rather than jumping to
\r
37 Date: Tue, 27 Dec 2011 10:50:44 +0000
\r
38 Message-Id: <1324983044-29249-1-git-send-email-dme@dme.org>
\r
39 X-Mailer: git-send-email 1.7.7.3
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Tue, 27 Dec 2011 10:50:51 -0000
\r
54 As suggested by j4ni in #notmuch, rename
\r
55 `notmuch-jump-to-recent-buffer' as `notmuch-cycle-notmuch-buffers' and
\r
56 have it behave accordingly.
\r
58 emacs/notmuch.el | 39 +++++++++++++++++++++++++++------------
\r
59 1 files changed, 27 insertions(+), 12 deletions(-)
\r
61 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
62 index c678c93..4844385 100644
\r
63 --- a/emacs/notmuch.el
\r
64 +++ b/emacs/notmuch.el
\r
65 @@ -1056,20 +1056,35 @@ current search results AND that are tagged with the given tag."
\r
69 -(defun notmuch-jump-to-recent-buffer ()
\r
70 - "Jump to the most recent notmuch buffer (search, show or hello).
\r
71 +(defun notmuch-cycle-notmuch-buffers ()
\r
72 + "Cycle through any existing notmuch buffers (search, show or hello).
\r
74 -If no recent buffer is found, run `notmuch'."
\r
75 +If the current buffer is the only notmuch buffer, bury it. If no
\r
76 +notmuch buffers exist, run `notmuch'."
\r
79 - (loop for buffer in (buffer-list)
\r
80 - if (with-current-buffer buffer
\r
81 - (memq major-mode '(notmuch-show-mode
\r
82 - notmuch-search-mode
\r
83 - notmuch-hello-mode)))
\r
86 - (switch-to-buffer last)
\r
88 + (let (start first)
\r
89 + ;; If the current buffer is a notmuch buffer, remember it and then
\r
91 + (when (memq major-mode '(notmuch-show-mode
\r
92 + notmuch-search-mode
\r
93 + notmuch-hello-mode))
\r
94 + (setq start (current-buffer))
\r
97 + ;; Find the first notmuch buffer.
\r
98 + (setq first (loop for buffer in (buffer-list)
\r
99 + if (with-current-buffer buffer
\r
100 + (memq major-mode '(notmuch-show-mode
\r
101 + notmuch-search-mode
\r
102 + notmuch-hello-mode)))
\r
106 + ;; If the first one we found is any other than the starting
\r
107 + ;; buffer, switch to it.
\r
108 + (unless (eq first start)
\r
109 + (switch-to-buffer first))
\r
112 (setq mail-user-agent 'notmuch-user-agent)
\r