[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / 4e / 837a7b43a70b015551bc0cdd060e7ae2ac66aa
1 Return-Path: <keithp@keithp.com>\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 D204A431FBC\r
6         for <notmuch@notmuchmail.org>; Fri, 20 Nov 2009 20:46:56 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id e0AWU1WVNgQu for <notmuch@notmuchmail.org>;\r
11         Fri, 20 Nov 2009 20:46:55 -0800 (PST)\r
12 Received: from keithp.com (home.keithp.com [63.227.221.253])\r
13         by olra.theworths.org (Postfix) with ESMTP id 5C927431FAE\r
14         for <notmuch@notmuchmail.org>; Fri, 20 Nov 2009 20:46:55 -0800 (PST)\r
15 Received: from localhost (localhost [127.0.0.1])\r
16         by keithp.com (Postfix) with ESMTP id 7DA1DB9404D\r
17         for <notmuch@notmuchmail.org>; Fri, 20 Nov 2009 20:46:54 -0800 (PST)\r
18 X-Virus-Scanned: Debian amavisd-new at keithp.com\r
19 Received: from keithp.com ([127.0.0.1])\r
20         by localhost (keithp.com [127.0.0.1]) (amavisd-new, port 10024)\r
21         with LMTP id 1Rq62PhyoFEF; Fri, 20 Nov 2009 20:46:51 -0800 (PST)\r
22 Received: by keithp.com (Postfix, from userid 1033)\r
23         id EA658B9404B; Fri, 20 Nov 2009 20:46:50 -0800 (PST)\r
24 Received: from koto.keithp.com (localhost [127.0.0.1])\r
25         by keithp.com (Postfix) with ESMTP id E3234B88003;\r
26         Fri, 20 Nov 2009 20:46:50 -0800 (PST)\r
27 Received: by koto.keithp.com (Postfix, from userid 1488)\r
28         id 838901982A0; Fri, 20 Nov 2009 20:46:50 -0800 (PST)\r
29 From: Keith Packard <keithp@keithp.com>\r
30 To: notmuch@notmuchmail.org\r
31 Date: Fri, 20 Nov 2009 20:46:49 -0800\r
32 Message-Id: <1258778809-16740-1-git-send-email-keithp@keithp.com>\r
33 X-Mailer: git-send-email 1.6.5.2\r
34 Subject: [notmuch] [PATCH] Make notmuch-show 'X' (and 'x') commands remove\r
35         inbox (and unread) tags\r
36 X-BeenThere: notmuch@notmuchmail.org\r
37 X-Mailman-Version: 2.1.12\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: Sat, 21 Nov 2009 04:46:57 -0000\r
49 \r
50 When closing a thread view, mark the thread as archived by removing\r
51 the "inbox" tag, and for the 'x' variant, the "unread" tag as well,\r
52 then kill the buffer and update the search window view as well.\r
53 \r
54 This makes 'x' much the same as 'a', but instead of taking you to the\r
55 next message, it takes you back to the search window instead.\r
56 \r
57 Signed-off-by: Keith Packard <keithp@keithp.com>\r
58 ---\r
59  notmuch.el |   86 ++++++++++++++++++++++++++++++++++++++++++++++-------------\r
60  1 files changed, 67 insertions(+), 19 deletions(-)\r
61 \r
62 This adds new functionality without removing any; without this patch,\r
63 the 'x' and 'q' commands do the same thing,  killing the buffer\r
64 without clearing any tags. With this patch, the 'x' command clears the\r
65 inbox and unread tags from the current message and returns to the\r
66 search index view, while the existing 'q' command continues to provide\r
67 old behaviour.\r
68 \r
69 diff --git a/notmuch.el b/notmuch.el\r
70 index cd3780f..544f281 100644\r
71 --- a/notmuch.el\r
72 +++ b/notmuch.el\r
73 @@ -31,8 +31,8 @@\r
74      ; Will be much preferable to switch to direct manipulation for\r
75      ; toggling visibility of these components. Probably using\r
76      ; overlays-at to query and manipulate the current overlay.\r
77 -    (define-key map "a" 'notmuch-show-archive-thread)\r
78 -    (define-key map "A" 'notmuch-show-mark-read-then-archive-thread)\r
79 +    (define-key map "a" 'notmuch-show-mark-read-archive-thread-next-thread)\r
80 +    (define-key map "A" 'notmuch-show-archive-thread-next-thread)\r
81      (define-key map "b" 'notmuch-show-toggle-body-read-visible)\r
82      (define-key map "c" 'notmuch-show-toggle-citations-visible)\r
83      (define-key map "h" 'notmuch-show-toggle-headers-visible)\r
84 @@ -47,7 +47,8 @@\r
85      (define-key map "s" 'notmuch-show-toggle-signatures-visible)\r
86      (define-key map "v" 'notmuch-show-view-all-mime-parts)\r
87      (define-key map "w" 'notmuch-show-view-raw-message)\r
88 -    (define-key map "x" 'kill-this-buffer)\r
89 +    (define-key map "x" 'notmuch-show-mark-read-archive-thread-kill-buffer)\r
90 +    (define-key map "X" 'notmuch-show-archive-thread-kill-buffer)\r
91      (define-key map "+" 'notmuch-show-add-tag)\r
92      (define-key map "-" 'notmuch-show-remove-tag)\r
93      (define-key map (kbd "DEL") 'notmuch-show-rewind)\r
94 @@ -193,7 +194,33 @@ Unlike builtin `next-line' this version accepts no arguments."\r
95                          (cons (notmuch-show-get-message-id) nil)))\r
96           (notmuch-show-set-tags (sort (set-difference tags toremove :test 'string=) 'string<))))))\r
97  \r
98 -(defun notmuch-show-archive-thread-maybe-mark-read (markread)\r
99 +(defun notmuch-show-next-thread (markread)\r
100 +  (let ((parent-buffer notmuch-show-parent-buffer))\r
101 +    (kill-this-buffer)\r
102 +    (if parent-buffer\r
103 +       (progn\r
104 +         (switch-to-buffer parent-buffer)\r
105 +         (forward-line)\r
106 +         (notmuch-search-show-thread)))))\r
107 +  \r
108 +(defun notmuch-delete-tags (to-remove from)\r
109 +  (if to-remove\r
110 +      (delete (car to-remove) (notmuch-delete-tags (cdr to-remove) from))\r
111 +    from))\r
112 +\r
113 +(defun notmuch-kill-message-buffer (markread)\r
114 +  (let ((parent-buffer notmuch-show-parent-buffer))\r
115 +    (kill-this-buffer)\r
116 +    (if parent-buffer\r
117 +       (progn\r
118 +         (switch-to-buffer parent-buffer)\r
119 +         (let ((tags (notmuch-search-get-tags)))\r
120 +           (setq tags (delete "inbox" tags))\r
121 +           (if markread (setq tags (delete "unread" tags)))\r
122 +           (notmuch-search-set-tags tags))\r
123 +         (forward-line)))))\r
124 +\r
125 +(defun notmuch-show-archive-thread-maybe-mark-read (markread shownext)\r
126    (save-excursion\r
127      (goto-char (point-min))\r
128      (while (not (eobp))\r
129 @@ -204,15 +231,9 @@ Unlike builtin `next-line' this version accepts no arguments."\r
130           (forward-char))\r
131        (if (not (re-search-forward notmuch-show-message-begin-regexp nil t))\r
132           (goto-char (point-max)))))\r
133 -  (let ((parent-buffer notmuch-show-parent-buffer))\r
134 -    (kill-this-buffer)\r
135 -    (if parent-buffer\r
136 -       (progn\r
137 -         (switch-to-buffer parent-buffer)\r
138 -         (forward-line)\r
139 -         (notmuch-search-show-thread)))))\r
140 +  (if shownext (notmuch-show-next-thread markread) (notmuch-kill-message-buffer markread)))\r
141  \r
142 -(defun notmuch-show-mark-read-then-archive-thread ()\r
143 +(defun notmuch-show-mark-read-archive-thread-next-thread ()\r
144    "Remove \"unread\" tag from each message, then archive and show next thread.\r
145  \r
146  Archive each message currently shown by removing the \"unread\"\r
147 @@ -225,9 +246,22 @@ being delivered to the same thread. It does not archive the\r
148  entire thread, but only the messages shown in the current\r
149  buffer."\r
150    (interactive)\r
151 -  (notmuch-show-archive-thread-maybe-mark-read t))\r
152 +  (notmuch-show-archive-thread-maybe-mark-read t t))\r
153 +\r
154 +(defun notmuch-show-mark-read-archive-thread-kill-buffer ()\r
155 +  "Remove \"unread\" tag from each message, then archive and kill the buffer.\r
156 +\r
157 +Archive each message currrently shown by removing the \"unread\"\r
158 +and \"inbox\" tag from each. Then kill this buffer.\r
159  \r
160 -(defun notmuch-show-archive-thread ()\r
161 +Note: This command is safe from any race condition of new messages\r
162 +being delivered to the same thread. It does not archive the\r
163 +entire thread, but only the messages shown in the current\r
164 +buffer."\r
165 +  (interactive)\r
166 +  (notmuch-show-archive-thread-maybe-mark-read t nil))\r
167 +\r
168 +(defun notmuch-show-archive-thread-next-thread ()\r
169    "Archive each message in thread, and show next thread from search.\r
170  \r
171  Archive each message currently shown by removing the \"inbox\"\r
172 @@ -239,7 +273,20 @@ being delivered to the same thread. It does not archive the\r
173  entire thread, but only the messages shown in the current\r
174  buffer."\r
175    (interactive)\r
176 -  (notmuch-show-archive-thread-maybe-mark-read nil))\r
177 +  (notmuch-show-archive-thread-maybe-mark-read nil t))\r
178 +\r
179 +(defun notmuch-show-archive-thread-kill-buffer ()\r
180 +  "Archive each message in thread, and kill the thread buffer.\r
181 +\r
182 +Archive each message currrently shown by removing the \"inbox\"\r
183 +tag from each. Then kill this buffer.\r
184 +\r
185 +Note: This command is safe from any race condition of new messages\r
186 +being delivered to the same thread. It does not archive the\r
187 +entire thread, but only the messages shown in the current\r
188 +buffer."\r
189 +  (interactive)\r
190 +  (notmuch-show-archive-thread-maybe-mark-read nil t))\r
191  \r
192  (defun notmuch-show-view-raw-message ()\r
193    "View the raw email of the current message."\r
194 @@ -310,7 +357,7 @@ by searching backward)."\r
195        (not (re-search-forward notmuch-show-message-begin-regexp nil t)))))\r
196  \r
197  (defun notmuch-show-message-unread-p ()\r
198 -  "Preficate testing whether current message is unread."\r
199 +  "Predicate testing whether current message is unread."\r
200    (member "unread" (notmuch-show-get-tags)))\r
201  \r
202  (defun notmuch-show-next-message ()\r
203 @@ -447,7 +494,7 @@ which this thread was originally shown."\r
204        (let ((last (notmuch-show-last-message-p)))\r
205         (notmuch-show-mark-read-then-next-open-message)\r
206         (if last\r
207 -           (notmuch-show-archive-thread))))))\r
208 +           (notmuch-show-archive-thread-next-thread))))))\r
209  \r
210  (defun notmuch-show-markup-citations-region (beg end depth)\r
211    (goto-char beg)\r
212 @@ -631,8 +678,9 @@ messages. Each time you navigate away from a message with\r
213  \r
214  You can add or remove tags from the current message with '+' and\r
215  '-'.  You can also archive all messages in the current\r
216 -view, (remove the \"inbox\" tag from each), with\r
217 -`notmuch-show-archive-thread' (bound to 'a' by default).\r
218 +view, (remove the \"inbox\" tag from each), with either\r
219 +`notmuch-show-archive-thread-next-thread' (bound to 'a' by default) or\r
220 +`notmuch-show-archive-thread-kill-buffer' (bound to 'x' by default).\r
221  \r
222  \\{notmuch-show-mode-map}"\r
223    (interactive)\r
224 -- \r
225 1.6.5.2\r
226 \r