Re: Hi all
[notmuch-archives.git] / 3d / abc77c654b9857202ccbb198a04c9a4ca2b483
1 Return-Path: <jrollins@finestructure.net>\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 7418240DDF9\r
6         for <notmuch@notmuchmail.org>; Sun, 14 Nov 2010 14:16:46 -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: -1.9\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9] autolearn=ham\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 gnWaTY8KED9f for <notmuch@notmuchmail.org>;\r
16         Sun, 14 Nov 2010 14:16:36 -0800 (PST)\r
17 Received: from tarap.cc.columbia.edu (tarap.cc.columbia.edu [128.59.29.7])\r
18         by olra.theworths.org (Postfix) with ESMTP id 4A7BE40DDCF\r
19         for <notmuch@notmuchmail.org>; Sun, 14 Nov 2010 14:16:36 -0800 (PST)\r
20 Received: from servo.finestructure.net (cpe-74-66-82-137.nyc.res.rr.com\r
21         [74.66.82.137])\r
22         (user=jgr2110 author=jrollins@finestructure.net mech=PLAIN bits=0)\r
23         by tarap.cc.columbia.edu (8.14.4/8.14.3) with ESMTP id oAEMGYHT001324\r
24         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT)\r
25         for <notmuch@notmuchmail.org>; Sun, 14 Nov 2010 17:16:35 -0500 (EST)\r
26 Received: from jrollins by servo.finestructure.net with local (Exim 4.72)\r
27         (envelope-from <jrollins@finestructure.net>) id 1PHksE-0004hL-8X\r
28         for notmuch@notmuchmail.org; Sun, 14 Nov 2010 17:16:34 -0500\r
29 From: Jameson Rollins <jrollins@finestructure.net>\r
30 To: Notmuch Mail <notmuch@notmuchmail.org>\r
31 Subject: [PATCH] emacs: add some convenience functions to show mode\r
32 Date: Sun, 14 Nov 2010 17:09:01 -0500\r
33 Message-ID: <87zktbeekd.fsf@servo.finestructure.net>\r
34 MIME-Version: 1.0\r
35 Content-Type: text/plain; charset=us-ascii\r
36 X-No-Spam-Score: Local\r
37 X-Scanned-By: MIMEDefang 2.68 on 128.59.29.7\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Sun, 14 Nov 2010 22:16:46 -0000\r
51 \r
52 Adding three new conveneince functions:\r
53 \r
54 notmuch-show-next-open-message-or-pop\r
55 notmuch-show-next-thread\r
56 notmuch-show-previous-thread\r
57 \r
58 While these are not currently bound to any keys, I have found them to\r
59 be very useful for constructing custom key bindings outside of what\r
60 notmuch provides by default.  For example:\r
61 \r
62 (define-key notmuch-show-mode-map "a"\r
63   (lambda ()\r
64     "archive current message and advance"\r
65     (interactive)\r
66     (notmuch-show-remove-tag "inbox")\r
67     (notmuch-show-next-open-message-or-pop)))\r
68 (define-key notmuch-show-mode-map "N" 'notmuch-show-next-thread)\r
69 (define-key notmuch-show-mode-map "P" 'notmuch-show-previous-thread)\r
70 ---\r
71  emacs/notmuch-show.el |   39 +++++++++++++++++++++++++++++++++++++++\r
72  1 files changed, 39 insertions(+), 0 deletions(-)\r
73 \r
74 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
75 index b89b685..820fd0e 100644\r
76 --- a/emacs/notmuch-show.el\r
77 +++ b/emacs/notmuch-show.el\r
78 @@ -920,6 +920,45 @@ any effects from previous calls to\r
79    (notmuch-show-mark-read)\r
80    (notmuch-show-message-adjust))\r
81  \r
82 +(defun notmuch-show-next-open-message-or-pop ()\r
83 +  "Show the next message or pop out if none remain."\r
84 +  (interactive)\r
85 +  (let (r)\r
86 +    (while (and (setq r (notmuch-show-goto-message-next))\r
87 +               (not (notmuch-show-message-visible-p))))\r
88 +    (if r\r
89 +       (progn\r
90 +         (notmuch-show-mark-read)\r
91 +         (notmuch-show-message-adjust))\r
92 +      (let ((parent-buffer notmuch-show-parent-buffer))\r
93 +       (if parent-buffer\r
94 +           (progn\r
95 +             (kill-this-buffer)\r
96 +             (switch-to-buffer parent-buffer)\r
97 +             (forward-line 1)))))))\r
98 +\r
99 +(defun notmuch-show-next-thread ()\r
100 +  "Move to the next thread from the last search."\r
101 +  (interactive)\r
102 +  (let ((parent-buffer notmuch-show-parent-buffer))\r
103 +    (if parent-buffer\r
104 +      (progn\r
105 +        (kill-this-buffer)\r
106 +        (switch-to-buffer parent-buffer)\r
107 +        (forward-line 1)\r
108 +        (notmuch-search-show-thread)))))\r
109 +\r
110 +(defun notmuch-show-previous-thread ()\r
111 +  "Move to the previous thread from the last search."\r
112 +  (interactive)\r
113 +  (let ((parent-buffer notmuch-show-parent-buffer))\r
114 +    (if parent-buffer\r
115 +      (progn\r
116 +        (kill-this-buffer)\r
117 +        (switch-to-buffer parent-buffer)\r
118 +        (forward-line -1)\r
119 +        (notmuch-search-show-thread)))))\r
120 +\r
121  (defun notmuch-show-view-raw-message ()\r
122    "View the file holding the current message."\r
123    (interactive)\r
124 -- \r
125 1.7.2.3\r
126 \r