1 Return-Path: <pieter@praet.org>
\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 64DF8429E2C
\r
6 for <notmuch@notmuchmail.org>; Fri, 13 May 2011 08:08:39 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 irR9awqoo7v3 for <notmuch@notmuchmail.org>;
\r
16 Fri, 13 May 2011 08:08:39 -0700 (PDT)
\r
17 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com
\r
18 [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 C4EF3431FD0 for <notmuch@notmuchmail.org>; Fri, 13 May 2011 08:08:38 -0700
\r
22 Received: by wwi36 with SMTP id 36so2394516wwi.2
\r
23 for <notmuch@notmuchmail.org>; Fri, 13 May 2011 08:08:37 -0700 (PDT)
\r
24 Received: by 10.227.178.135 with SMTP id bm7mr1544984wbb.52.1305299317443;
\r
25 Fri, 13 May 2011 08:08:37 -0700 (PDT)
\r
26 Received: from localhost (54.209-242-81.adsl-dyn.isp.belgacom.be
\r
28 by mx.google.com with ESMTPS id bo14sm1018033wbb.28.2011.05.13.08.08.24
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Fri, 13 May 2011 08:08:35 -0700 (PDT)
\r
31 From: Pieter Praet <pieter@praet.org>
\r
32 To: Notmuch Mail <notmuch@notmuchmail.org>
\r
33 Subject: [PATCH 3/3] emacs: generalize notmuch-message-mark-replied
\r
34 Date: Fri, 13 May 2011 17:07:50 +0200
\r
35 Message-Id: <1305299270-4316-3-git-send-email-pieter@praet.org>
\r
36 X-Mailer: git-send-email 1.7.4.1
\r
37 In-Reply-To: <1305299270-4316-1-git-send-email-pieter@praet.org>
\r
38 References: <1305275652-22956-1-git-send-email-pieter@praet.org>
\r
39 <1305299270-4316-1-git-send-email-pieter@praet.org>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Fri, 13 May 2011 15:08:39 -0000
\r
54 Renamed 'notmuch-message-mark-replied' to 'notmuch-message-mod-tags'.
\r
56 Previously (semi)hardcoded vars are now to be provided as arguments,
\r
57 allowing much more flexibility re autotagging in message-mode.
\r
59 Paving the way towards proper draft handling?
\r
61 Signed-off-by: Pieter Praet <pieter@praet.org>
\r
63 emacs/notmuch-message.el | 27 ++++++++++++++++++---------
\r
64 1 files changed, 18 insertions(+), 9 deletions(-)
\r
66 diff --git a/emacs/notmuch-message.el b/emacs/notmuch-message.el
\r
67 index c8b19c3..6026740 100644
\r
68 --- a/emacs/notmuch-message.el
\r
69 +++ b/emacs/notmuch-message.el
\r
72 (require 'notmuch-mua)
\r
74 +(defvar notmuch-message-parent nil)
\r
76 (defcustom notmuch-message-replied-tags '("replied")
\r
77 "Tags to be automatically added to or removed from a message when it is replied to.
\r
78 Any tag in the list will be added to a replied message or,
\r
79 @@ -33,20 +35,27 @@ the \"inbox\" and \"todo\", you would set
\r
83 -(defun notmuch-message-mark-replied ()
\r
84 - ;; get the in-reply-to header and parse it for the message id.
\r
85 - (let ((rep (mail-header-parse-addresses (message-field-value "In-Reply-To"))))
\r
86 - (when (and notmuch-message-replied-tags rep)
\r
87 - ;; add a "+" to any tag that is doesn't already begin with a "+"
\r
89 +(defun notmuch-message-mod-tags (msgid tagops)
\r
90 + (when (and msgid tagops)
\r
91 + ;; prepend operator-less tags with a "+"
\r
92 (let ((tags (mapcar '(lambda (str)
\r
93 (if (not (string-match "^[+-]" str))
\r
96 - notmuch-message-replied-tags)))
\r
98 (apply 'notmuch-call-notmuch-process "tag"
\r
99 - (append tags (list (concat "id:" (car (car rep)))) nil))))))
\r
100 + (append tags (list (concat "id:" msgid)) nil)))))
\r
102 +(add-hook 'message-setup-hook
\r
104 + (set (make-local-variable 'notmuch-message-parent)
\r
105 + ;; get the in-reply-to header and parse it for the message id.
\r
106 + (car (car (mail-header-parse-addresses (message-field-value "In-Reply-To")))))))
\r
108 +(add-hook 'message-sent-hook
\r
110 + (notmuch-message-mod-tags notmuch-message-parent
\r
111 + notmuch-message-replied-tags)))
\r
113 -(add-hook 'message-sent-hook 'notmuch-message-mark-replied)
\r
115 (provide 'notmuch-message)
\r