Re: [PATCH] cli: fix documentation about --decrypt for show
[notmuch-archives.git] / 4e / 88fe9e4a8461a6c6079b41a2d6f38607e24d7b
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 92122421176\r
6         for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 21:35:27 -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: -0.799\r
10 X-Spam-Level: \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 3gOTwwCRfsQ6 for <notmuch@notmuchmail.org>;\r
17         Sun, 29 Jan 2012 21:35:25 -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 041FC421166\r
22         for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 21:35:23 -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:23 -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=BRoFNgFZMGszZ0lxWKjSYg5xKR9s/9rVloL7JNfGA0g=;\r
28         b=qkSC96sbO9l0aGZJcgO7afJDRe+60tm59JAm9vPjRfiX4QMRIuMO22rSmNIqRU95+j\r
29         vEvXfchgqksifi1uBHpLzQw/wQOiWp7kg6Gs/5mf5Si9AGIzXsL4aTV9eUWm9luc+jCm\r
30         Laj1K16k3rBSRixUSX17OMRLFyNpDn4hQOjnk=\r
31 Received: by 10.204.157.130 with SMTP id b2mr7906278bkx.22.1327901723747;\r
32         Sun, 29 Jan 2012 21:35:23 -0800 (PST)\r
33 Received: from localhost ([91.144.186.21])\r
34         by mx.google.com with ESMTPS id t17sm35182165bke.6.2012.01.29.21.35.22\r
35         (version=TLSv1/SSLv3 cipher=OTHER);\r
36         Sun, 29 Jan 2012 21:35:23 -0800 (PST)\r
37 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v3 04/12] emacs: make "+" and "-" tagging operations in\r
40         notmuch-show more flexible\r
41 Date: Mon, 30 Jan 2012 09:33:56 +0400\r
42 Message-Id: <1327901644-15799-5-git-send-email-dmitry.kurochkin@gmail.com>\r
43 X-Mailer: git-send-email 1.7.8.3\r
44 In-Reply-To: <1327901644-15799-1-git-send-email-dmitry.kurochkin@gmail.com>\r
45 References: <1327725684-5887-1-git-send-email-dmitry.kurochkin@gmail.com>\r
46         <1327901644-15799-1-git-send-email-dmitry.kurochkin@gmail.com>\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.13\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Mon, 30 Jan 2012 05:35:28 -0000\r
60 \r
61 Before the change, "+" and "-" tagging operations in notmuch-show view\r
62 accepted only a single tag.  The patch makes them use the recently\r
63 added `notmuch-read-tag-changes' function, which allows to enter\r
64 multiple tags with "+" and "-" prefixes.  So after the change, "+" and\r
65 "-" bindings in notmuch-show view allow to both add and remove\r
66 multiple tags.  The only difference between "+" and "-" is the\r
67 minibuffer initial input ("+" and "-" respectively).\r
68 ---\r
69  emacs/notmuch-show.el |   64 +++++++++++++++++-------------------------------\r
70  1 files changed, 23 insertions(+), 41 deletions(-)\r
71 \r
72 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
73 index 84ac624..11dab2d 100644\r
74 --- a/emacs/notmuch-show.el\r
75 +++ b/emacs/notmuch-show.el\r
76 @@ -38,8 +38,9 @@\r
77  \r
78  (declare-function notmuch-call-notmuch-process "notmuch" (&rest args))\r
79  (declare-function notmuch-fontify-headers "notmuch" nil)\r
80 -(declare-function notmuch-select-tag-with-completion "notmuch" (prompt &rest search-terms))\r
81 +(declare-function notmuch-read-tag-changes "notmuch" (&optional initial-input &rest search-terms))\r
82  (declare-function notmuch-search-show-thread "notmuch" nil)\r
83 +(declare-function notmuch-update-tags "notmuch" (current-tags tag-changes))\r
84  \r
85  (defcustom notmuch-message-headers '("Subject" "To" "Cc" "Date")\r
86    "Headers that should be shown in a message, in this order.\r
87 @@ -1267,7 +1268,7 @@ Some useful entries are:\r
88  \r
89  (defun notmuch-show-mark-read ()\r
90    "Mark the current message as read."\r
91 -  (notmuch-show-remove-tag "unread"))\r
92 +  (notmuch-show-tag-message "-unread"))\r
93  \r
94  ;; Functions for getting attributes of several messages in the current\r
95  ;; thread.\r
96 @@ -1470,51 +1471,32 @@ than only the current message."\r
97             (message (format "Command '%s' exited abnormally with code %d"\r
98                              shell-command exit-code))))))))\r
99  \r
100 -(defun notmuch-show-add-tags-worker (current-tags add-tags)\r
101 -  "Add to `current-tags' with any tags from `add-tags' not\r
102 -currently present and return the result."\r
103 -  (let ((result-tags (copy-sequence current-tags)))\r
104 -    (mapc (lambda (add-tag)\r
105 -           (unless (member add-tag current-tags)\r
106 -             (setq result-tags (push add-tag result-tags))))\r
107 -           add-tags)\r
108 -    (sort result-tags 'string<)))\r
109 -\r
110 -(defun notmuch-show-del-tags-worker (current-tags del-tags)\r
111 -  "Remove any tags in `del-tags' from `current-tags' and return\r
112 -the result."\r
113 -  (let ((result-tags (copy-sequence current-tags)))\r
114 -    (mapc (lambda (del-tag)\r
115 -           (setq result-tags (delete del-tag result-tags)))\r
116 -         del-tags)\r
117 -    result-tags))\r
118 -\r
119 -(defun notmuch-show-add-tag (&rest toadd)\r
120 -  "Add a tag to the current message."\r
121 -  (interactive\r
122 -   (list (notmuch-select-tag-with-completion "Tag to add: ")))\r
123 +(defun notmuch-show-tag-message (&rest tag-changes)\r
124 +  "Change tags for the current message.\r
125  \r
126 +TAG-CHANGES is a list of tag operations for `notmuch-tag'."\r
127    (let* ((current-tags (notmuch-show-get-tags))\r
128 -        (new-tags (notmuch-show-add-tags-worker current-tags toadd)))\r
129 -\r
130 +        (new-tags (notmuch-update-tags current-tags tag-changes)))\r
131      (unless (equal current-tags new-tags)\r
132 -      (apply 'notmuch-tag (notmuch-show-get-message-id)\r
133 -            (mapcar (lambda (s) (concat "+" s)) toadd))\r
134 +      (apply 'notmuch-tag (notmuch-show-get-message-id) tag-changes)\r
135        (notmuch-show-set-tags new-tags))))\r
136  \r
137 -(defun notmuch-show-remove-tag (&rest toremove)\r
138 -  "Remove a tag from the current message."\r
139 -  (interactive\r
140 -   (list (notmuch-select-tag-with-completion\r
141 -         "Tag to remove: " (notmuch-show-get-message-id))))\r
142 +(defun notmuch-show-tag (&optional initial-input)\r
143 +  "Change tags for the current message, read input from the minibuffer."\r
144 +  (interactive)\r
145 +  (let ((tag-changes (notmuch-read-tag-changes\r
146 +                     initial-input (notmuch-show-get-message-id))))\r
147 +    (apply 'notmuch-show-tag-message tag-changes)))\r
148  \r
149 -  (let* ((current-tags (notmuch-show-get-tags))\r
150 -        (new-tags (notmuch-show-del-tags-worker current-tags toremove)))\r
151 +(defun notmuch-show-add-tag ()\r
152 +  "Same as `notmuch-show-tag' but sets initial input to '+'."\r
153 +  (interactive)\r
154 +  (notmuch-show-tag "+"))\r
155  \r
156 -    (unless (equal current-tags new-tags)\r
157 -      (apply 'notmuch-tag (notmuch-show-get-message-id)\r
158 -            (mapcar (lambda (s) (concat "-" s)) toremove))\r
159 -      (notmuch-show-set-tags new-tags))))\r
160 +(defun notmuch-show-remove-tag ()\r
161 +  "Same as `notmuch-show-tag' but sets initial input to '-'."\r
162 +  (interactive)\r
163 +  (notmuch-show-tag "-"))\r
164  \r
165  (defun notmuch-show-toggle-headers ()\r
166    "Toggle the visibility of the current message headers."\r
167 @@ -1559,7 +1541,7 @@ argument, hide all of the messages."\r
168  (defun notmuch-show-archive-thread-internal (show-next)\r
169    ;; Remove the tag from the current set of messages.\r
170    (goto-char (point-min))\r
171 -  (loop do (notmuch-show-remove-tag "inbox")\r
172 +  (loop do (notmuch-show-tag-message "-inbox")\r
173         until (not (notmuch-show-goto-message-next)))\r
174    ;; Move to the next item in the search results, if any.\r
175    (let ((parent-buffer notmuch-show-parent-buffer))\r
176 -- \r
177 1.7.8.3\r
178 \r