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 CB0FF429E25
\r
6 for <notmuch@notmuchmail.org>; Wed, 28 Dec 2011 00:30:04 -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 HPQxuZFapChg for <notmuch@notmuchmail.org>;
\r
16 Wed, 28 Dec 2011 00:30:04 -0800 (PST)
\r
17 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
18 [209.85.212.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 29AF4431FB6
\r
21 for <notmuch@notmuchmail.org>; Wed, 28 Dec 2011 00:30:04 -0800 (PST)
\r
22 Received: by wibhq2 with SMTP id hq2so6574947wib.26
\r
23 for <notmuch@notmuchmail.org>; Wed, 28 Dec 2011 00:30:03 -0800 (PST)
\r
24 Received: by 10.180.91.201 with SMTP id cg9mr68289772wib.15.1325061002940;
\r
25 Wed, 28 Dec 2011 00:30:02 -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 k5sm72525358wiz.9.2011.12.28.00.30.01
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Wed, 28 Dec 2011 00:30:01 -0800 (PST)
\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)
\r
32 id E8100A0334; Wed, 28 Dec 2011 08:29:59 +0000 (GMT)
\r
33 From: David Edmondson <dme@dme.org>
\r
34 To: notmuch@notmuchmail.org
\r
35 Subject: [PATCH v2] emacs: Cycle through notmuch buffers rather than jumping
\r
37 Date: Wed, 28 Dec 2011 08:29:58 +0000
\r
38 Message-Id: <1325060998-25567-1-git-send-email-dme@dme.org>
\r
39 X-Mailer: git-send-email 1.7.7.3
\r
40 In-Reply-To: <1324983044-29249-1-git-send-email-dme@dme.org>
\r
41 References: <1324983044-29249-1-git-send-email-dme@dme.org>
\r
42 X-BeenThere: notmuch@notmuchmail.org
\r
43 X-Mailman-Version: 2.1.13
\r
45 List-Id: "Use and development of the notmuch mail system."
\r
46 <notmuch.notmuchmail.org>
\r
47 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
49 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
50 List-Post: <mailto:notmuch@notmuchmail.org>
\r
51 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
52 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
53 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
54 X-List-Received-Date: Wed, 28 Dec 2011 08:30:04 -0000
\r
56 As suggested by j4ni in #notmuch, rename
\r
57 `notmuch-jump-to-recent-buffer' as `notmuch-cycle-notmuch-buffers' and
\r
58 have it behave accordingly.
\r
60 Consider `message-mode' buffers to be of interest.
\r
62 emacs/notmuch.el | 42 ++++++++++++++++++++++++++++++------------
\r
63 1 files changed, 30 insertions(+), 12 deletions(-)
\r
65 diff --git a/emacs/notmuch.el b/emacs/notmuch.el
\r
66 index c678c93..6a44d49 100644
\r
67 --- a/emacs/notmuch.el
\r
68 +++ b/emacs/notmuch.el
\r
69 @@ -1055,21 +1055,39 @@ current search results AND that are tagged with the given tag."
\r
73 +(defun notmuch-interesting-buffer (b)
\r
74 + "Is the current buffer of interest to a notmuch user?"
\r
75 + (with-current-buffer b
\r
76 + (memq major-mode '(notmuch-show-mode
\r
77 + notmuch-search-mode
\r
78 + notmuch-hello-mode
\r
82 -(defun notmuch-jump-to-recent-buffer ()
\r
83 - "Jump to the most recent notmuch buffer (search, show or hello).
\r
84 +(defun notmuch-cycle-notmuch-buffers ()
\r
85 + "Cycle through any existing notmuch buffers (search, show or hello).
\r
87 -If no recent buffer is found, run `notmuch'."
\r
88 +If the current buffer is the only notmuch buffer, bury it. If no
\r
89 +notmuch buffers exist, run `notmuch'."
\r
92 - (loop for buffer in (buffer-list)
\r
93 - if (with-current-buffer buffer
\r
94 - (memq major-mode '(notmuch-show-mode
\r
95 - notmuch-search-mode
\r
96 - notmuch-hello-mode)))
\r
99 - (switch-to-buffer last)
\r
101 + (let (start first)
\r
102 + ;; If the current buffer is a notmuch buffer, remember it and then
\r
104 + (when (notmuch-interesting-buffer (current-buffer))
\r
105 + (setq start (current-buffer))
\r
108 + ;; Find the first notmuch buffer.
\r
109 + (setq first (loop for buffer in (buffer-list)
\r
110 + if (notmuch-interesting-buffer buffer)
\r
114 + ;; If the first one we found is any other than the starting
\r
115 + ;; buffer, switch to it.
\r
116 + (unless (eq first start)
\r
117 + (switch-to-buffer first))
\r
120 (setq mail-user-agent 'notmuch-user-agent)
\r