]> git.notmuchmail.org Git - notmuch/blob - emacs/notmuch-message.el
Merge branch 'release'
[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 (require 'notmuch-mua)
27
28 (defcustom notmuch-message-replied-tags '("+replied")
29   "List of tag changes to apply to a message when it has been replied to.
30
31 Tags starting with \"+\" (or not starting with either \"+\" or
32 \"-\") in the list will be added, and tags starting with \"-\"
33 will be removed from the message being replied to.
34
35 For example, if you wanted to add a \"replied\" tag and remove
36 the \"inbox\" and \"todo\" tags, you would set:
37     (\"+replied\" \"-inbox\" \"-todo\"\)"
38   :type '(repeat string)
39   :group 'notmuch-send)
40
41 (defun notmuch-message-mark-replied ()
42   ;; get the in-reply-to header and parse it for the message id.
43   (let ((rep (mail-header-parse-addresses (message-field-value "In-Reply-To"))))
44     (when (and notmuch-message-replied-tags rep)
45       (notmuch-tag (notmuch-id-to-query (car (car rep)))
46                (notmuch-tag-change-list notmuch-message-replied-tags)))))
47
48 (add-hook 'message-send-hook 'notmuch-message-mark-replied)
49
50 (provide 'notmuch-message)
51
52 ;;; notmuch-message.el ends here