Re: [PATCH] cli: bail out and propagate tagging errors in notmuch tag
[notmuch-archives.git] / 7f / 1ec47e61c8b9d282f046eb5bf09e06f2f9ed30
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 0E107431FD0\r
6         for <notmuch@notmuchmail.org>; Tue, 20 Dec 2011 00:01:53 -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.7\r
10 X-Spam-Level: \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 4FA+XUQnYFFa for <notmuch@notmuchmail.org>;\r
16         Tue, 20 Dec 2011 00:01:52 -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 5E33D431FB6\r
21         for <notmuch@notmuchmail.org>; Tue, 20 Dec 2011 00:01:52 -0800 (PST)\r
22 Received: by werm12 with SMTP id m12so2321626wer.26\r
23         for <notmuch@notmuchmail.org>; Tue, 20 Dec 2011 00:01:51 -0800 (PST)\r
24 Received: by 10.216.131.155 with SMTP id m27mr554033wei.19.1324368110967;\r
25         Tue, 20 Dec 2011 00:01:50 -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 eg7sm2280291wib.8.2011.12.20.00.01.49\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Tue, 20 Dec 2011 00:01:50 -0800 (PST)\r
31 Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000)\r
32         id 724FAA0179; Tue, 20 Dec 2011 08:01:48 +0000 (GMT)\r
33 From: David Edmondson <dme@dme.org>\r
34 To: notmuch@notmuchmail.org\r
35 Subject: [PATCH v2] emacs: Add `notmuch-jump-to-recent-buffer'.\r
36 Date: Tue, 20 Dec 2011 08:01:46 +0000\r
37 Message-Id: <1324368106-24802-1-git-send-email-dme@dme.org>\r
38 X-Mailer: git-send-email 1.7.7.3\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Tue, 20 Dec 2011 08:01:53 -0000\r
52 \r
53 >From a Carl Worth idea: add a function which will select the most\r
54 recently used notmuch buffer (search, show or hello). If no recent\r
55 buffer is found, run `notmuch'.\r
56 \r
57 It is expected that the user will global bind this command to a key\r
58 sequence.\r
59 ---\r
60  emacs/notmuch.el |   17 +++++++++++++++++\r
61  1 files changed, 17 insertions(+), 0 deletions(-)\r
62 \r
63 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
64 index 2e9973e..da61aa9 100644\r
65 --- a/emacs/notmuch.el\r
66 +++ b/emacs/notmuch.el\r
67 @@ -1055,6 +1055,23 @@ current search results AND that are tagged with the given tag."\r
68    (interactive)\r
69    (notmuch-hello))\r
70  \r
71 +;;;###autoload\r
72 +(defun notmuch-jump-to-recent-buffer ()\r
73 +  "Jump to the most recent notmuch buffer (search, show or hello).\r
74 +\r
75 +If no recent buffer is found, run `notmuch'."\r
76 +  (interactive)\r
77 +  (let ((last\r
78 +        (loop for buffer in (buffer-list)\r
79 +              if (with-current-buffer buffer\r
80 +                   (memq major-mode '(notmuch-show-mode\r
81 +                                      notmuch-search-mode\r
82 +                                      notmuch-hello-mode)))\r
83 +              return buffer)))\r
84 +    (if last\r
85 +       (switch-to-buffer last)\r
86 +      (notmuch))))\r
87 +\r
88  (setq mail-user-agent 'notmuch-user-agent)\r
89  \r
90  (provide 'notmuch)\r
91 -- \r
92 1.7.7.3\r
93 \r