1 Return-Path: <pieter@praet.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 27C60429E4D
\r
6 for <notmuch@notmuchmail.org>; Sat, 14 Jan 2012 01:31:21 -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 fIJ0od3aIsoi for <notmuch@notmuchmail.org>;
\r
16 Sat, 14 Jan 2012 01:31:20 -0800 (PST)
\r
17 Received: from mail-we0-f181.google.com (mail-we0-f181.google.com
\r
18 [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 5AA93429E4A
\r
21 for <notmuch@notmuchmail.org>; Sat, 14 Jan 2012 01:31:20 -0800 (PST)
\r
22 Received: by werh12 with SMTP id h12so21762wer.26
\r
23 for <notmuch@notmuchmail.org>; Sat, 14 Jan 2012 01:31:19 -0800 (PST)
\r
24 Received: by 10.216.136.23 with SMTP id v23mr520747wei.48.1326533479053;
\r
25 Sat, 14 Jan 2012 01:31:19 -0800 (PST)
\r
26 Received: from localhost ([109.131.75.86])
\r
27 by mx.google.com with ESMTPS id ga4sm14231108wbb.4.2012.01.14.01.31.18
\r
28 (version=TLSv1/SSLv3 cipher=OTHER);
\r
29 Sat, 14 Jan 2012 01:31:18 -0800 (PST)
\r
30 From: Pieter Praet <pieter@praet.org>
\r
31 To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org
\r
32 Subject: Re: [PATCH v2] emacs: Cycle through notmuch buffers rather than
\r
33 jumping to the last.
\r
34 In-Reply-To: <1325060998-25567-1-git-send-email-dme@dme.org>
\r
35 References: <1324983044-29249-1-git-send-email-dme@dme.org>
\r
36 <1325060998-25567-1-git-send-email-dme@dme.org>
\r
37 User-Agent: Notmuch/0.10.2+115~gadd29f6 (http://notmuchmail.org) Emacs/23.3.1
\r
38 (x86_64-unknown-linux-gnu)
\r
39 Date: Sat, 14 Jan 2012 10:29:31 +0100
\r
40 Message-ID: <87boq6pr7o.fsf@praet.org>
\r
42 Content-Type: text/plain; charset=us-ascii
\r
43 X-BeenThere: notmuch@notmuchmail.org
\r
44 X-Mailman-Version: 2.1.13
\r
46 List-Id: "Use and development of the notmuch mail system."
\r
47 <notmuch.notmuchmail.org>
\r
48 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
50 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
51 List-Post: <mailto:notmuch@notmuchmail.org>
\r
52 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
53 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
54 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
55 X-List-Received-Date: Sat, 14 Jan 2012 09:31:21 -0000
\r
57 On Wed, 28 Dec 2011 08:29:58 +0000, David Edmondson <dme@dme.org> wrote:
\r
58 > As suggested by j4ni in #notmuch, rename
\r
59 > `notmuch-jump-to-recent-buffer' as `notmuch-cycle-notmuch-buffers' and
\r
60 > have it behave accordingly.
\r
62 > Consider `message-mode' buffers to be of interest.
\r
64 > emacs/notmuch.el | 42 ++++++++++++++++++++++++++++++------------
\r
65 > 1 files changed, 30 insertions(+), 12 deletions(-)
\r
67 > diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
68 > index c678c93..6a44d49 100644
\r
69 > --- a/emacs/notmuch.el
\r
70 > +++ b/emacs/notmuch.el
\r
71 > @@ -1055,21 +1055,39 @@ current search results AND that are tagged with the given tag."
\r
75 > +(defun notmuch-interesting-buffer (b)
\r
76 > + "Is the current buffer of interest to a notmuch user?"
\r
77 > + (with-current-buffer b
\r
78 > + (memq major-mode '(notmuch-show-mode
\r
79 > + notmuch-search-mode
\r
80 > + notmuch-hello-mode
\r
81 > + message-mode))))
\r
84 > -(defun notmuch-jump-to-recent-buffer ()
\r
85 > - "Jump to the most recent notmuch buffer (search, show or hello).
\r
86 > +(defun notmuch-cycle-notmuch-buffers ()
\r
87 > + "Cycle through any existing notmuch buffers (search, show or hello).
\r
89 > -If no recent buffer is found, run `notmuch'."
\r
90 > +If the current buffer is the only notmuch buffer, bury it. If no
\r
91 > +notmuch buffers exist, run `notmuch'."
\r
94 > - (loop for buffer in (buffer-list)
\r
95 > - if (with-current-buffer buffer
\r
96 > - (memq major-mode '(notmuch-show-mode
\r
97 > - notmuch-search-mode
\r
98 > - notmuch-hello-mode)))
\r
99 > - return buffer)))
\r
101 > - (switch-to-buffer last)
\r
103 > + (let (start first)
\r
104 > + ;; If the current buffer is a notmuch buffer, remember it and then
\r
106 > + (when (notmuch-interesting-buffer (current-buffer))
\r
107 > + (setq start (current-buffer))
\r
110 > + ;; Find the first notmuch buffer.
\r
111 > + (setq first (loop for buffer in (buffer-list)
\r
112 > + if (notmuch-interesting-buffer buffer)
\r
113 > + return buffer))
\r
116 > + ;; If the first one we found is any other than the starting
\r
117 > + ;; buffer, switch to it.
\r
118 > + (unless (eq first start)
\r
119 > + (switch-to-buffer first))
\r
122 > (setq mail-user-agent 'notmuch-user-agent)
\r
126 Signed-off-by: Pieter Praet <pieter@praet.org> !
\r
129 Might I ask, to what key(chord) have you bound this ? Due to its
\r
130 usefulness, I'm inclined to bind it to [SPC], but on second though,
\r
131 that might be a bit on the intense side...
\r