1 Return-Path: <dmitry.kurochkin@gmail.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 53CAA42119B
\r
6 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 21:35:33 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5
\r
12 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
\r
13 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id N5yWaXgBtCAi for <notmuch@notmuchmail.org>;
\r
17 Sun, 29 Jan 2012 21:35:31 -0800 (PST)
\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com
\r
19 [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id BA7C4421166
\r
22 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 21:35:29 -0800 (PST)
\r
23 Received: by mail-bk0-f53.google.com with SMTP id 11so1052482bke.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 21:35:29 -0800 (PST)
\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
\r
26 h=from:to:subject:date:message-id:x-mailer:in-reply-to:references;
\r
27 bh=u9rVzzUG2a+Jqp+amJmuF5nbQ1/9zkGrOB8yFrtpmPU=;
\r
28 b=v+HsclUT2SVdLJQ6xhs4MW363guhHX+vLLKbHv9t10zS4TnBrjEBpqqzLQdkAZpnlH
\r
29 k8XuWRUfNuEl34rnS+4F3+ry2X8yd4kRvQk2sJ7T52Ca69iw6QVnIgh7KPSkwdjho0LK
\r
30 FH4ShpmiEtc724kHIBvZzycNYDCcI32iJhnag=
\r
31 Received: by 10.205.133.133 with SMTP id hy5mr8013158bkc.94.1327901729482;
\r
32 Sun, 29 Jan 2012 21:35:29 -0800 (PST)
\r
33 Received: from localhost ([91.144.186.21])
\r
34 by mx.google.com with ESMTPS id ez5sm35112010bkc.15.2012.01.29.21.35.28
\r
35 (version=TLSv1/SSLv3 cipher=OTHER);
\r
36 Sun, 29 Jan 2012 21:35:29 -0800 (PST)
\r
37 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
\r
38 To: notmuch@notmuchmail.org
\r
39 Subject: [PATCH v3 07/12] emacs: add "*" binding for notmuch-show view
\r
40 Date: Mon, 30 Jan 2012 09:33:59 +0400
\r
41 Message-Id: <1327901644-15799-8-git-send-email-dmitry.kurochkin@gmail.com>
\r
42 X-Mailer: git-send-email 1.7.8.3
\r
43 In-Reply-To: <1327901644-15799-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
44 References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
45 <1327901644-15799-1-git-send-email-dmitry.kurochkin@gmail.com>
\r
46 X-BeenThere: notmuch@notmuchmail.org
\r
47 X-Mailman-Version: 2.1.13
\r
49 List-Id: "Use and development of the notmuch mail system."
\r
50 <notmuch.notmuchmail.org>
\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
54 List-Post: <mailto:notmuch@notmuchmail.org>
\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
57 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
58 X-List-Received-Date: Mon, 30 Jan 2012 05:35:33 -0000
\r
60 The patch adds `notmuch-show-tag-all' function bound to "*" in
\r
61 notmuch-show view. The function is similar to the
\r
62 `notmuch-search-tag-all' function for the notmuch-search view: it
\r
63 changes tags for all messages in the current thread.
\r
65 emacs/notmuch-show.el | 35 +++++++++++++++++++++++++++++++++++
\r
66 1 files changed, 35 insertions(+), 0 deletions(-)
\r
68 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
69 index 11dab2d..69381ac 100644
\r
70 --- a/emacs/notmuch-show.el
\r
71 +++ b/emacs/notmuch-show.el
\r
72 @@ -1073,6 +1073,7 @@ thread id. If a prefix is given, crypto processing is toggled."
\r
73 (define-key map "c" 'notmuch-show-stash-map)
\r
74 (define-key map "=" 'notmuch-show-refresh-view)
\r
75 (define-key map "h" 'notmuch-show-toggle-headers)
\r
76 + (define-key map "*" 'notmuch-show-tag-all)
\r
77 (define-key map "-" 'notmuch-show-remove-tag)
\r
78 (define-key map "+" 'notmuch-show-add-tag)
\r
79 (define-key map "x" 'notmuch-show-archive-thread-then-exit)
\r
80 @@ -1169,6 +1170,15 @@ All currently available key bindings:
\r
81 (notmuch-show-move-to-message-top)
\r
84 +(defun notmuch-show-mapc (function)
\r
85 + "Iterate through all messages in the current thread with
\r
86 +`notmuch-show-goto-message-next' and call FUNCTION for side
\r
89 + (goto-char (point-min))
\r
90 + (loop do (funcall function)
\r
91 + while (notmuch-show-goto-message-next))))
\r
93 ;; Functions relating to the visibility of messages and their
\r
96 @@ -1221,6 +1231,18 @@ Some useful entries are:
\r
97 "Return the message id of the current message."
\r
98 (concat "id:\"" (notmuch-show-get-prop :id) "\""))
\r
100 +(defun notmuch-show-get-messages-ids ()
\r
101 + "Return all message ids of messages in the current thread."
\r
102 + (let ((message-ids))
\r
103 + (notmuch-show-mapc
\r
104 + (lambda () (push (notmuch-show-get-message-id) message-ids)))
\r
107 +(defun notmuch-show-get-messages-ids-search ()
\r
108 + "Return a search string for all message ids of messages in the
\r
110 + (mapconcat 'identity (notmuch-show-get-messages-ids) " or "))
\r
112 ;; dme: Would it make sense to use a macro for many of these?
\r
114 (defun notmuch-show-get-filename ()
\r
115 @@ -1488,6 +1510,19 @@ TAG-CHANGES is a list of tag operations for `notmuch-tag'."
\r
116 initial-input (notmuch-show-get-message-id))))
\r
117 (apply 'notmuch-show-tag-message tag-changes)))
\r
119 +(defun notmuch-show-tag-all (&rest tag-changes)
\r
120 + "Change tags for all messages in the current thread.
\r
122 +TAG-CHANGES is a list of tag operations for `notmuch-tag'."
\r
123 + (interactive (notmuch-read-tag-changes nil notmuch-show-thread-id))
\r
124 + (apply 'notmuch-tag (notmuch-show-get-messages-ids-search) tag-changes)
\r
125 + (notmuch-show-mapc
\r
127 + (let* ((current-tags (notmuch-show-get-tags))
\r
128 + (new-tags (notmuch-update-tags current-tags tag-changes)))
\r
129 + (unless (equal current-tags new-tags)
\r
130 + (notmuch-show-set-tags new-tags))))))
\r
132 (defun notmuch-show-add-tag ()
\r
133 "Same as `notmuch-show-tag' but sets initial input to '+'."
\r