]> git.notmuchmail.org Git - notmuch/blob - emacs/notmuch-message.el
Merge tag 0.28.4
[notmuch] / emacs / notmuch-message.el
1 ;;; notmuch-message.el --- message-mode functions specific to notmuch
2 ;;
3 ;; Copyright © Jesse Rosenthal
4 ;;
5 ;; This file is part of Notmuch.
6 ;;
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.
11 ;;
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.
16 ;;
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/>.
19 ;;
20 ;; Authors: Jesse Rosenthal <jrosenthal@jhu.edu>
21
22 ;;; Code:
23
24 (require 'message)
25 (require 'notmuch-tag)
26
27 (defcustom notmuch-message-replied-tags '("+replied")
28   "List of tag changes to apply to a message when it has been replied to.
29
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.
33
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)
38   :group 'notmuch-send)
39
40 (defcustom notmuch-message-forwarded-tags '("+forwarded")
41   "List of tag changes to apply to a message when it has been forwarded.
42
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.
46
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)
51   :group 'notmuch-send)
52
53 (defconst notmuch-message-queued-tag-changes nil
54   "List of messages and corresponding tag-changes to be applied when sending a message.
55
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.")
61
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))))
67
68 (add-hook 'message-send-hook 'notmuch-message-apply-queued-tag-changes)
69
70 (provide 'notmuch-message)
71
72 ;;; notmuch-message.el ends here