Re: Hi all
[notmuch-archives.git] / 9c / 7efa0cc78dfd46fe7eba40aebe6e2f0d453c64
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 C6A77431FAE\r
6         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 08:49:01 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.321\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.321 tagged_above=-999 required=5\r
12         tests=[NO_DNS_FOR_FROM=0.379, RCVD_IN_DNSWL_LOW=-0.7]\r
13         autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id BlbayOKRSzUR for <notmuch@notmuchmail.org>;\r
17         Mon, 16 Jan 2012 08:48:49 -0800 (PST)\r
18 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
19         [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id ABE69431FAF\r
22         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 08:48:49 -0800 (PST)\r
23 Received: by wibhr12 with SMTP id hr12so2622452wib.26\r
24         for <notmuch@notmuchmail.org>; Mon, 16 Jan 2012 08:48:48 -0800 (PST)\r
25 Received: by 10.180.107.195 with SMTP id he3mr21634230wib.13.1326732528596;\r
26         Mon, 16 Jan 2012 08:48:48 -0800 (PST)\r
27 Received: from localhost ([109.131.75.86])\r
28         by mx.google.com with ESMTPS id ee6sm35022735wib.4.2012.01.16.08.48.47\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Mon, 16 Jan 2012 08:48:47 -0800 (PST)\r
31 From: Pieter Praet <pieter@praet.org>\r
32 To: David Edmondson <dme@dme.org>,\r
33         Austin Clements <amdragon@MIT.EDU>\r
34 Subject: [PATCH] v2 [RFC] emacs: merge overhauled\r
35         `notmuch-cycle-notmuch-buffers' into `notmuch'\r
36 Date: Mon, 16 Jan 2012 17:46:55 +0100\r
37 Message-Id: <1326732415-21894-1-git-send-email-pieter@praet.org>\r
38 X-Mailer: git-send-email 1.7.8.1\r
39 In-Reply-To: <87r4yza95m.fsf@praet.org>\r
40 References: <87r4yza95m.fsf@praet.org>\r
41 Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
42 X-BeenThere: notmuch@notmuchmail.org\r
43 X-Mailman-Version: 2.1.13\r
44 Precedence: list\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: Mon, 16 Jan 2012 16:49:02 -0000\r
55 \r
56 Make `notmuch-cycle-notmuch-buffers' more Lispy and merge into `notmuch',\r
57 eliminating the need to hog yet another keybind.\r
58 \r
59 ---\r
60  emacs/notmuch.el |   40 ++++++++++++++--------------------------\r
61  1 files changed, 14 insertions(+), 26 deletions(-)\r
62 \r
63 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
64 index ef4dcc7..539b3a0 100644\r
65 --- a/emacs/notmuch.el\r
66 +++ b/emacs/notmuch.el\r
67 @@ -1067,7 +1067,20 @@ current search results AND that are tagged with the given tag."\r
68  (defun notmuch ()\r
69    "Run notmuch and display saved searches, known tags, etc."\r
70    (interactive)\r
71 -  (notmuch-hello))\r
72 +  (let* ((old-buffer (current-buffer))\r
73 +        (interesting-buffers\r
74 +         (delq nil (mapcar (lambda (b)\r
75 +                             (if (notmuch-interesting-buffer b) b))\r
76 +                           (buffer-list))))\r
77 +        (next-buffer (first\r
78 +         (delq nil (mapcar (lambda (b)\r
79 +                             (unless (eq old-buffer b) b))\r
80 +                           interesting-buffers)))))\r
81 +    (if next-buffer\r
82 +       (progn\r
83 +         (switch-to-buffer next-buffer)\r
84 +         (bury-buffer old-buffer))\r
85 +      (notmuch-hello))))\r
86  \r
87  (defun notmuch-interesting-buffer (b)\r
88    "Is the current buffer of interest to a notmuch user?"\r
89 @@ -1078,31 +1091,6 @@ current search results AND that are tagged with the given tag."\r
90                        message-mode))))\r
91  \r
92  ;;;###autoload\r
93 -(defun notmuch-cycle-notmuch-buffers ()\r
94 -  "Cycle through any existing notmuch buffers (search, show or hello).\r
95 -\r
96 -If the current buffer is the only notmuch buffer, bury it. If no\r
97 -notmuch buffers exist, run `notmuch'."\r
98 -  (interactive)\r
99 -\r
100 -  (let (start first)\r
101 -    ;; If the current buffer is a notmuch buffer, remember it and then\r
102 -    ;; bury it.\r
103 -    (when (notmuch-interesting-buffer (current-buffer))\r
104 -      (setq start (current-buffer))\r
105 -      (bury-buffer))\r
106 -\r
107 -    ;; Find the first notmuch buffer.\r
108 -    (setq first (loop for buffer in (buffer-list)\r
109 -                    if (notmuch-interesting-buffer buffer)\r
110 -                    return buffer))\r
111 -\r
112 -    (if first\r
113 -       ;; If the first one we found is any other than the starting\r
114 -       ;; buffer, switch to it.\r
115 -       (unless (eq first start)\r
116 -         (switch-to-buffer first))\r
117 -      (notmuch))))\r
118  \r
119  (setq mail-user-agent 'notmuch-user-agent)\r
120  \r
121 -- \r
122 1.7.8.1\r
123 \r