1 ;;; notmuch-message.el --- message-mode functions specific to notmuch
3 ;; Copyright © Jesse Rosenthal
5 ;; This file is part of Notmuch.
7 ;; Notmuch is free software: you can redistribute it and/or modify it
8 ;; under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; Notmuch is distributed in the hope that it will be useful, but
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;; General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with Notmuch. If not, see <https://www.gnu.org/licenses/>.
20 ;; Authors: Jesse Rosenthal <jrosenthal@jhu.edu>
25 (require 'notmuch-tag)
27 (defcustom notmuch-message-replied-tags '("+replied")
28 "List of tag changes to apply to a message when it has been replied to.
30 Tags starting with \"+\" (or not starting with either \"+\" or
31 \"-\") in the list will be added, and tags starting with \"-\"
32 will be removed from the message being replied to.
34 For example, if you wanted to add a \"replied\" tag and remove
35 the \"inbox\" and \"todo\" tags, you would set:
36 (\"+replied\" \"-inbox\" \"-todo\")"
37 :type '(repeat string)
40 (defcustom notmuch-message-forwarded-tags '("+forwarded")
41 "List of tag changes to apply to a message when it has been forwarded.
43 Tags starting with \"+\" (or not starting with either \"+\" or
44 \"-\") in the list will be added, and tags starting with \"-\"
45 will be removed from the message being forwarded.
47 For example, if you wanted to add a \"forwarded\" tag and remove
48 the \"inbox\" tag, you would set:
49 (\"+forwarded\" \"-inbox\")"
50 :type '(repeat string)
53 (defconst notmuch-message-queued-tag-changes nil
54 "List of messages and corresponding tag-changes to be applied when sending a message.
56 This variable is overridden by buffer-local versions in message
57 buffers where tag changes should be triggered when sending off
58 the message. Each item in this list is a list of strings, where
59 the first is a notmuch query and the rest are the tag changes to
60 be applied to the matching messages.")
62 (defun notmuch-message-apply-queued-tag-changes ()
63 ;; Apply the tag changes queued in the buffer-local variable notmuch-message-queued-tag-changes.
64 (dolist (query-and-tags notmuch-message-queued-tag-changes)
65 (notmuch-tag (car query-and-tags)
66 (cdr query-and-tags))))
68 (add-hook 'message-send-hook 'notmuch-message-apply-queued-tag-changes)
70 (provide 'notmuch-message)
72 ;;; notmuch-message.el ends here