Re: [BUG/PATCH v2 1/2] emacs: Fix header problem in reply for emacs 23.2
[notmuch-archives.git] / ab / fcc2c9d11ba94d9edc5ae539bdc71d3d583b9f
1 Return-Path: <BATV+95f6b7a4aaa7c13215e8+2420+infradead.org+hohndel@bombadil.srs.infradead.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 435E34196F0\r
6         for <notmuch@notmuchmail.org>; Fri,  9 Apr 2010 12:53:28 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -4.2\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-4.2 tagged_above=-999 required=5\r
12         tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3] 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 7HYv0vt-mbIz for <notmuch@notmuchmail.org>;\r
16         Fri,  9 Apr 2010 12:53:27 -0700 (PDT)\r
17 Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 73200431FC1\r
19         for <notmuch@notmuchmail.org>; Fri,  9 Apr 2010 12:53:27 -0700 (PDT)\r
20 Received: from localhost ([::1] helo=localhost.localdomain)\r
21         by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux))\r
22         id 1O0KGd-0007Mz-18\r
23         for notmuch@notmuchmail.org; Fri, 09 Apr 2010 19:53:27 +0000\r
24 Received: by localhost.localdomain (Postfix, from userid 500)\r
25         id 3532AC00E1; Fri,  9 Apr 2010 12:53:26 -0700 (PDT)\r
26 From: Dirk Hohndel <hohndel@infradead.org>\r
27 To: <notmuch@notmuchmail.org>\r
28 Subject: [PATCH] Add 'G' keybinding to folder and search view that triggers\r
29         external poll\r
30 Date: Fri, 09 Apr 2010 12:53:26 -0700\r
31 Message-ID: <m339z4csi1.fsf@x200.gr8dns.org>\r
32 MIME-Version: 1.0\r
33 Content-Type: text/plain; charset=us-ascii\r
34 X-SRS-Rewrite: SMTP reverse-path rewritten from <hohndel@infradead.org> by\r
35         bombadil.infradead.org See http://www.infradead.org/rpr.html\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.13\r
38 Precedence: list\r
39 List-Id: "Use and development of the notmuch mail system."\r
40         <notmuch.notmuchmail.org>\r
41 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
42         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
43 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
44 List-Post: <mailto:notmuch@notmuchmail.org>\r
45 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
46 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
47         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
48 X-List-Received-Date: Fri, 09 Apr 2010 19:53:28 -0000\r
49 \r
50 \r
51 The new functions first check if an external poll script has been defined in\r
52 the variable 'notmuch-external-refresh-script and if yes, runs that script\r
53 before executing the existing refresh function (which is bound to '=')\r
54 \r
55 This can be used to have 'G' mimic the mutt behavior of polling an external\r
56 mail server - or if the mail polling is already automatic, it can trigger\r
57 the call to notmuch new and any necessary automatic tagging of new email.\r
58 \r
59 Signed-off-by: Dirk Hohndel <hohndel@infradead.org>\r
60 ---\r
61  emacs/notmuch.el |   24 ++++++++++++++++++++++++\r
62  1 files changed, 24 insertions(+), 0 deletions(-)\r
63 \r
64 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
65 index 517c53a..a56b949 100644\r
66 --- a/emacs/notmuch.el\r
67 +++ b/emacs/notmuch.el\r
68 @@ -260,6 +260,7 @@ For a mouse binding, return nil."\r
69      (define-key map "s" 'notmuch-search)\r
70      (define-key map "o" 'notmuch-search-toggle-order)\r
71      (define-key map "=" 'notmuch-search-refresh-view)\r
72 +    (define-key map "G" 'notmuch-poll-and-search-refresh-view)\r
73      (define-key map "t" 'notmuch-search-filter-by-tag)\r
74      (define-key map "f" 'notmuch-search-filter)\r
75      (define-key map [mouse-1] 'notmuch-search-show-thread)\r
76 @@ -747,6 +748,17 @@ same relative position within the new buffer."\r
77      (goto-char (point-min))\r
78      ))\r
79  \r
80 +(defun notmuch-poll-and-search-refresh-view ()\r
81 +  "Run external script to import mail and refresh the current view.\r
82 +\r
83 +Checks if the variable 'notmuch-external-refresh-script is defined\r
84 +and runs the external program defined it provides. Then calls\r
85 +notmuch-search-refresh-view to refresh the current view."\r
86 +  (interactive)\r
87 +  (if (boundp 'notmuch-external-refresh-script)\r
88 +      (call-process notmuch-external-refresh-script nil nil))\r
89 +  (notmuch-search-refresh-view))\r
90 +\r
91  (defun notmuch-search-toggle-order ()\r
92    "Toggle the current search order.\r
93  \r
94 @@ -801,6 +813,7 @@ current search results AND that are tagged with the given tag."\r
95      (define-key map ">" 'notmuch-folder-last)\r
96      (define-key map "<" 'notmuch-folder-first)\r
97      (define-key map "=" 'notmuch-folder)\r
98 +    (define-key map "G" 'notmuch-poll-and-folder)\r
99      (define-key map "s" 'notmuch-search)\r
100      (define-key map [mouse-1] 'notmuch-folder-show-search)\r
101      (define-key map (kbd "RET") 'notmuch-folder-show-search)\r
102 @@ -919,6 +932,17 @@ Currently available key bindings:\r
103      (if search\r
104         (notmuch-search (cdr search) notmuch-search-oldest-first))))\r
105  \r
106 +(defun notmuch-poll-and-folder ()\r
107 +  "Run external script to import mail and refresh the folder view.\r
108 +\r
109 +Checks if the variable 'notmuch-external-refresh-script is defined\r
110 +and runs the external program defined it provides. Then calls\r
111 +notmuch-folder to refresh the current view."\r
112 +  (interactive)\r
113 +  (if (boundp 'notmuch-external-refresh-script)\r
114 +      (call-process notmuch-external-refresh-script nil nil))\r
115 +  (notmuch-folder))\r
116 +\r
117  ;;;###autoload\r
118  (defun notmuch-folder ()\r
119    "Show the notmuch folder view and update the displayed counts."\r
120 -- \r
121 1.6.6.1\r
122 \r
123 \r
124 -- \r
125 Dirk Hohndel\r
126 Intel Open Source Technology Center\r