Re: [PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page
[notmuch-archives.git] / 2d / 82f066fe54a83579a38f6aae09ce213b023e4c
1 Return-Path: <amdragon@mit.edu>\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 CBEED431FDF\r
6         for <notmuch@notmuchmail.org>; Thu, 29 Aug 2013 09:26:45 -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: -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 T9kmMr5OdUUR for <notmuch@notmuchmail.org>;\r
16         Thu, 29 Aug 2013 09:26:41 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu\r
18         [18.9.25.13])\r
19         by olra.theworths.org (Postfix) with ESMTP id A6AE9431E62\r
20         for <notmuch@notmuchmail.org>; Thu, 29 Aug 2013 09:26:15 -0700 (PDT)\r
21 X-AuditID: 1209190d-b7f078e000000937-04-521f7627e10c\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id E2.0B.02359.7267F125; Thu, 29 Aug 2013 12:26:15 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
26         by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r7TGQ3nZ018774; \r
27         Thu, 29 Aug 2013 12:26:04 -0400\r
28 Received: from drake.dyndns.org\r
29         (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
30         [216.15.114.40]) (authenticated bits=0)\r
31         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
32         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7TGQ1Te014999\r
33         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
34         Thu, 29 Aug 2013 12:26:02 -0400\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
36         (envelope-from <amdragon@mit.edu>)\r
37         id 1VF52n-0007Ww-3S; Thu, 29 Aug 2013 12:26:01 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: notmuch@notmuchmail.org\r
40 Subject: [PATCH 6/9] emacs: Add unified refresh-this-buffer function\r
41 Date: Thu, 29 Aug 2013 12:25:54 -0400\r
42 Message-Id: <1377793557-28878-7-git-send-email-amdragon@mit.edu>\r
43 X-Mailer: git-send-email 1.7.10.4\r
44 In-Reply-To: <1377793557-28878-1-git-send-email-amdragon@mit.edu>\r
45 References: <1377793557-28878-1-git-send-email-amdragon@mit.edu>\r
46 X-Brightmail-Tracker:\r
47  H4sIAAAAAAAAA+NgFlrPIsWRmVeSWpSXmKPExsUixG6nrqteJh9k8Pgfs8X1mzOZHRg9nq26\r
48         xRzAGMVlk5Kak1mWWqRvl8CVsXJWA1vBBuOK/1ttGhjna3cxcnJICJhInP48gRXCFpO4cG89\r
49         G4gtJLCPUeLMbcYuRi4geyOjxKt/d9khEneYJBauMYRIzGWUmNo/FyzBJqAhsW3/ckYQW0RA\r
50         WmLn3dlAUzk4mAXUJP50qYCEhQVcJBYe3AVWwiKgKjFvzk82kBJeAQeJ9X9qIG5QlOh+NgHs\r
51         Bk4BR4n+u29ZINY6SPy5+JR9AiP/AkaGVYyyKblVurmJmTnFqcm6xcmJeXmpRbpGermZJXqp\r
52         KaWbGEHhwinJu4Px3UGlQ4wCHIxKPLwPg+WDhFgTy4orcw8xSnIwKYnyBpYAhfiS8lMqMxKL\r
53         M+KLSnNSiw8xSnAwK4nwvuUEyvGmJFZWpRblw6SkOViUxHmfPj0bKCSQnliSmp2aWpBaBJOV\r
54         4eBQkuCNLwVqFCxKTU+tSMvMKUFIM3FwggznARpuBVLDW1yQmFucmQ6RP8WoKCXOawaSEABJ\r
55         ZJTmwfXC4vkVozjQK8K8YSBVPMBUANf9CmgwE9DgCflyIINLEhFSUg2My99/cY80ydhsvSh7\r
56         Vu3dq6qqh7QOfO1vXLP4R+yaV8syVbaq7Jr+Z/WHLQ3nBTnOBm3cZLPxx699GbVMrUdaH67Y\r
57         P8lQwrpp8bbl76Vv2e6blWo6selcksDMJT0XWA9vjnSLXHFqf8XWqZ3yAdtKJbifzfKNeOLo\r
58         z5K62f3yq49Pzx9T/X3j6SklluKMREMt5qLiRAC4zM/qwgIAAA==\r
59 X-BeenThere: notmuch@notmuchmail.org\r
60 X-Mailman-Version: 2.1.13\r
61 Precedence: list\r
62 List-Id: "Use and development of the notmuch mail system."\r
63         <notmuch.notmuchmail.org>\r
64 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
65         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
66 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
67 List-Post: <mailto:notmuch@notmuchmail.org>\r
68 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
69 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
71 X-List-Received-Date: Thu, 29 Aug 2013 16:26:46 -0000\r
72 \r
73 This unifies the various refresh and poll-and-refresh functions we\r
74 have for different modes.  Now all modes bind "=" and "G" (except\r
75 show, which doesn't bind "G" for some reason) to\r
76 `notmuch-refresh-this-buffer' and\r
77 `notmuch-poll-and-refresh-this-buffer', respectively.\r
78 ---\r
79  emacs/notmuch-hello.el |   12 +++---------\r
80  emacs/notmuch-lib.el   |   20 +++++++++++++++++++-\r
81  emacs/notmuch-show.el  |    3 ++-\r
82  emacs/notmuch.el       |   12 +++---------\r
83  4 files changed, 27 insertions(+), 20 deletions(-)\r
84 \r
85 diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el\r
86 index c9d484c..147e2dd 100644\r
87 --- a/emacs/notmuch-hello.el\r
88 +++ b/emacs/notmuch-hello.el\r
89 @@ -476,15 +476,8 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
90  (defun notmuch-hello-update (&optional no-display)\r
91    "Update the current notmuch view."\r
92    ;; Lazy - rebuild everything.\r
93 -  (interactive)\r
94    (notmuch-hello no-display))\r
95  \r
96 -(defun notmuch-hello-poll-and-update ()\r
97 -  "Invoke `notmuch-poll' to import mail, then refresh the current view."\r
98 -  (interactive)\r
99 -  (notmuch-poll)\r
100 -  (notmuch-hello-update))\r
101 -\r
102  (defvar notmuch-hello-inhibit-auto-refresh nil\r
103    "Don't refresh notmuch-hello on window configuration changes.")\r
104  \r
105 @@ -523,8 +516,8 @@ Such a list can be computed with `notmuch-hello-query-counts'."\r
106                           (message "notmuch version %s" (notmuch-version))))\r
107      (define-key map "?" 'notmuch-help)\r
108      (define-key map "q" 'notmuch-kill-this-buffer)\r
109 -    (define-key map "=" 'notmuch-hello-update)\r
110 -    (define-key map "G" 'notmuch-hello-poll-and-update)\r
111 +    (define-key map "=" 'notmuch-refresh-this-buffer)\r
112 +    (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)\r
113      (define-key map (kbd "<C-tab>") 'widget-backward)\r
114      (define-key map "m" 'notmuch-mua-new-mail)\r
115      (define-key map "s" 'notmuch-search)\r
116 @@ -540,6 +533,7 @@ Complete list of currently available key bindings:\r
117  \\{notmuch-hello-mode-map}"\r
118   (interactive)\r
119   (kill-all-local-variables)\r
120 + (setq notmuch-buffer-refresh-function #'notmuch-hello-update)\r
121   (use-local-map notmuch-hello-mode-map)\r
122   (setq major-mode 'notmuch-hello-mode\r
123         mode-name "notmuch-hello")\r
124 diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el\r
125 index 9754e16..782badb 100644\r
126 --- a/emacs/notmuch-lib.el\r
127 +++ b/emacs/notmuch-lib.el\r
128 @@ -204,6 +204,25 @@ depending on the value of `notmuch-poll-script'."\r
129    (interactive)\r
130    (kill-buffer (current-buffer)))\r
131  \r
132 +(defvar notmuch-buffer-refresh-function nil\r
133 +  "Function to call to refresh the current buffer.")\r
134 +(make-variable-buffer-local 'notmuch-buffer-refresh-function)\r
135 +\r
136 +(defun notmuch-refresh-this-buffer ()\r
137 +  "Refresh the current buffer."\r
138 +  (interactive)\r
139 +  (when notmuch-buffer-refresh-function\r
140 +    (if (commandp notmuch-buffer-refresh-function)\r
141 +       ;; Pass prefix argument, etc.\r
142 +       (call-interactively notmuch-buffer-refresh-function)\r
143 +      (funcall notmuch-buffer-refresh-function))))\r
144 +\r
145 +(defun notmuch-poll-and-refresh-this-buffer ()\r
146 +  "Invoke `notmuch-poll' to import mail, then refresh the current buffer."\r
147 +  (interactive)\r
148 +  (notmuch-poll)\r
149 +  (notmuch-refresh-this-buffer))\r
150 +\r
151  (defun notmuch-prettify-subject (subject)\r
152    ;; This function is used by `notmuch-search-process-filter' which\r
153    ;; requires that we not disrupt its' matching state.\r
154 @@ -596,7 +615,6 @@ status."\r
155  (defvar notmuch-show-process-crypto nil)\r
156  (make-variable-buffer-local 'notmuch-show-process-crypto)\r
157  \r
158 -\r
159  (provide 'notmuch-lib)\r
160  \r
161  ;; Local Variables:\r
162 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
163 index 82b70ba..380df66 100644\r
164 --- a/emacs/notmuch-show.el\r
165 +++ b/emacs/notmuch-show.el\r
166 @@ -1279,7 +1279,7 @@ reset based on the original query."\r
167         (define-key map "w" 'notmuch-show-save-attachments)\r
168         (define-key map "V" 'notmuch-show-view-raw-message)\r
169         (define-key map "c" 'notmuch-show-stash-map)\r
170 -       (define-key map "=" 'notmuch-show-refresh-view)\r
171 +       (define-key map "=" 'notmuch-refresh-this-buffer)\r
172         (define-key map "h" 'notmuch-show-toggle-visibility-headers)\r
173         (define-key map "*" 'notmuch-show-tag-all)\r
174         (define-key map "-" 'notmuch-show-remove-tag)\r
175 @@ -1338,6 +1338,7 @@ All currently available key bindings:\r
176  \\{notmuch-show-mode-map}"\r
177    (interactive)\r
178    (kill-all-local-variables)\r
179 +  (setq notmuch-buffer-refresh-function #'notmuch-show-refresh-view)\r
180    (use-local-map notmuch-show-mode-map)\r
181    (setq major-mode 'notmuch-show-mode\r
182         mode-name "notmuch-show")\r
183 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
184 index 82cece8..80446be 100644\r
185 --- a/emacs/notmuch.el\r
186 +++ b/emacs/notmuch.el\r
187 @@ -228,8 +228,8 @@ For a mouse binding, return nil."\r
188      (define-key map "s" 'notmuch-search)\r
189      (define-key map "o" 'notmuch-search-toggle-order)\r
190      (define-key map "c" 'notmuch-search-stash-map)\r
191 -    (define-key map "=" 'notmuch-search-refresh-view)\r
192 -    (define-key map "G" 'notmuch-search-poll-and-refresh-view)\r
193 +    (define-key map "=" 'notmuch-refresh-this-buffer)\r
194 +    (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)\r
195      (define-key map "t" 'notmuch-search-filter-by-tag)\r
196      (define-key map "f" 'notmuch-search-filter)\r
197      (define-key map [mouse-1] 'notmuch-search-show-thread)\r
198 @@ -403,6 +403,7 @@ Complete list of currently available key bindings:\r
199    (make-local-variable 'notmuch-search-oldest-first)\r
200    (make-local-variable 'notmuch-search-target-thread)\r
201    (make-local-variable 'notmuch-search-target-line)\r
202 +  (setq notmuch-buffer-refresh-function #'notmuch-search-refresh-view)\r
203    (set (make-local-variable 'scroll-preserve-screen-position) t)\r
204    (add-to-invisibility-spec (cons 'ellipsis t))\r
205    (use-local-map notmuch-search-mode-map)\r
206 @@ -950,7 +951,6 @@ query string as the current search. If the current thread is in\r
207  the new search results, then point will be placed on the same\r
208  thread. Otherwise, point will be moved to attempt to be in the\r
209  same relative position within the new buffer."\r
210 -  (interactive)\r
211    (let ((target-line (line-number-at-pos))\r
212         (oldest-first notmuch-search-oldest-first)\r
213         (target-thread (notmuch-search-find-thread-id 'bare))\r
214 @@ -959,12 +959,6 @@ same relative position within the new buffer."\r
215      (notmuch-search query oldest-first target-thread target-line)\r
216      (goto-char (point-min))))\r
217  \r
218 -(defun notmuch-search-poll-and-refresh-view ()\r
219 -  "Invoke `notmuch-poll' to import mail, then refresh the current view."\r
220 -  (interactive)\r
221 -  (notmuch-poll)\r
222 -  (notmuch-search-refresh-view))\r
223 -\r
224  (defun notmuch-search-toggle-order ()\r
225    "Toggle the current search order.\r
226  \r
227 -- \r
228 1.7.10.4\r
229 \r