[PATCH 6/8] CLI: refactor dumping of tags.
[notmuch-archives.git] / 32 / 5476f109f39afe035a4c310a93928ba364f70f
1 Return-Path: <anarcat@anarcat.ath.cx>\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 1B025431FD0\r
6         for <notmuch@notmuchmail.org>; Sat, 16 Jul 2011 11:40:29 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 xkap4AnwjqI9 for <notmuch@notmuchmail.org>;\r
16         Sat, 16 Jul 2011 11:40:27 -0700 (PDT)\r
17 Received: from marcos.anarcat.ath.cx (H144.C72.B0.tor.eicat.ca [72.0.72.144])\r
18         by olra.theworths.org (Postfix) with ESMTP id 28DA5431FB6\r
19         for <notmuch@notmuchmail.org>; Sat, 16 Jul 2011 11:40:27 -0700 (PDT)\r
20 Received: by marcos.anarcat.ath.cx (Postfix, from userid 1000)\r
21         id 73C817621D; Sat, 16 Jul 2011 14:40:26 -0400 (EDT)\r
22 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= <anarcat@koumbit.org>\r
23 To: notmuch@notmuchmail.org\r
24 Subject: [PATCH 1/2] add notmuch keybinding 'd'\r
25 Date: Sat, 16 Jul 2011 14:39:59 -0400\r
26 Message-Id: <1310841600-28281-1-git-send-email-anarcat@koumbit.org>\r
27 X-Mailer: git-send-email 1.7.5.4\r
28 In-Reply-To: <1266408746-28549-1-git-send-email-Sebastian@SSpaeth.de>\r
29 References: <1266408746-28549-1-git-send-email-Sebastian@SSpaeth.de>\r
30 MIME-Version: 1.0\r
31 Content-Type: text/plain; charset=UTF-8\r
32 Content-Transfer-Encoding: 8bit\r
33 Cc: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= <anarcat@koumbit.org>\r
34 X-BeenThere: notmuch@notmuchmail.org\r
35 X-Mailman-Version: 2.1.13\r
36 Precedence: list\r
37 List-Id: "Use and development of the notmuch mail system."\r
38         <notmuch.notmuchmail.org>\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
40         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
42 List-Post: <mailto:notmuch@notmuchmail.org>\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
46 X-List-Received-Date: Sat, 16 Jul 2011 18:40:29 -0000\r
47 \r
48 It adds a tag 'deleted' and removes the tags 'inbox' and 'unread'. It\r
49 works in show as well as in search mode\r
50 \r
51 Based on previous work by: Sebastian Spaeth <Sebastian@SSpaeth.de>\r
52 \r
53 Signed-off-by: Antoine Beaupré <anarcat@koumbit.org>\r
54 ---\r
55  emacs/notmuch-show.el |    8 ++++++++\r
56  emacs/notmuch.el      |   11 +++++++++++\r
57  2 files changed, 19 insertions(+), 0 deletions(-)\r
58 \r
59 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
60 index f96743b..c83b992 100644\r
61 --- a/emacs/notmuch-show.el\r
62 +++ b/emacs/notmuch-show.el\r
63 @@ -875,6 +875,7 @@ function is used. "\r
64         (define-key map "+" 'notmuch-show-add-tag)\r
65         (define-key map "x" 'notmuch-show-archive-thread-then-exit)\r
66         (define-key map "a" 'notmuch-show-archive-thread)\r
67 +       (define-key map "d" 'notmuch-show-delete)\r
68         (define-key map "N" 'notmuch-show-next-message)\r
69         (define-key map "P" 'notmuch-show-previous-message)\r
70         (define-key map "n" 'notmuch-show-next-open-message)\r
71 @@ -1297,6 +1298,13 @@ the result."\r
72              (mapcar (lambda (s) (concat "-" s)) toremove))\r
73        (notmuch-show-set-tags new-tags))))\r
74  \r
75 +(defun notmuch-show-delete ()\r
76 +  "Delete current mail (tag +deleted -unread -inbox)."\r
77 +  (interactive)\r
78 +  (notmuch-show-add-tag "deleted")\r
79 +  (notmuch-show-remove-tag "unread")\r
80 +  (notmuch-show-remove-tag "inbox"))\r
81 +\r
82  (defun notmuch-show-toggle-headers ()\r
83    "Toggle the visibility of the current message headers."\r
84    (interactive)\r
85 diff --git a/emacs/notmuch.el b/emacs/notmuch.el\r
86 index f11ec24..f6fb07b 100644\r
87 --- a/emacs/notmuch.el\r
88 +++ b/emacs/notmuch.el\r
89 @@ -215,6 +215,7 @@ For a mouse binding, return nil."\r
90      (define-key map [mouse-1] 'notmuch-search-show-thread)\r
91      (define-key map "*" 'notmuch-search-operate-all)\r
92      (define-key map "a" 'notmuch-search-archive-thread)\r
93 +    (define-key map "d" 'notmuch-search-delete-thread-or-region)\r
94      (define-key map "-" 'notmuch-search-remove-tag)\r
95      (define-key map "+" 'notmuch-search-add-tag)\r
96      (define-key map (kbd "RET") 'notmuch-search-show-thread)\r
97 @@ -611,6 +612,16 @@ This function advances the next thread when finished."\r
98    "Data that has not yet been processed.")\r
99  (make-variable-buffer-local 'notmuch-search-process-filter-data)\r
100  \r
101 +(defun notmuch-search-delete-thread-or-region ()\r
102 +  "Delete the currently selected thread (tag \"+deleted -inbox -unread\").\r
103 +\r
104 +This function advances the next thread when finished."\r
105 +  (interactive)\r
106 +  (notmuch-search-add-tag "deleted")\r
107 +  (notmuch-search-remove-tag "inbox")\r
108 +  (notmuch-search-remove-tag "unread")\r
109 +  (forward-line))\r
110 +\r
111  (defun notmuch-search-process-sentinel (proc msg)\r
112    "Add a message to let user know when \"notmuch search\" exits"\r
113    (let ((buffer (process-buffer proc))\r
114 -- \r
115 1.7.5.4\r
116 \r