mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-28 13:44:12 +01:00
emacs: Tag forwarded messages with +forwarded (customizable)
Use the buffer-local variable notmuch-message-queued-tag-changes to change tags when the forwarding message is sent.
This commit is contained in:
parent
d9800c8932
commit
606f2a6615
2 changed files with 25 additions and 2 deletions
|
@ -37,6 +37,19 @@ the \"inbox\" and \"todo\" tags, you would set:
|
||||||
:type '(repeat string)
|
:type '(repeat string)
|
||||||
:group 'notmuch-send)
|
:group 'notmuch-send)
|
||||||
|
|
||||||
|
(defcustom notmuch-message-forwarded-tags '("+forwarded")
|
||||||
|
"List of tag changes to apply to a message when it has been forwarded.
|
||||||
|
|
||||||
|
Tags starting with \"+\" (or not starting with either \"+\" or
|
||||||
|
\"-\") in the list will be added, and tags starting with \"-\"
|
||||||
|
will be removed from the message being forwarded.
|
||||||
|
|
||||||
|
For example, if you wanted to add a \"forwarded\" tag and remove
|
||||||
|
the \"inbox\" tag, you would set:
|
||||||
|
(\"+forwarded\" \"-inbox\")"
|
||||||
|
:type '(repeat string)
|
||||||
|
:group 'notmuch-send)
|
||||||
|
|
||||||
(defconst notmuch-message-queued-tag-changes nil
|
(defconst notmuch-message-queued-tag-changes nil
|
||||||
"List of messages and corresponding tag-changes to be applied when sending a message.
|
"List of messages and corresponding tag-changes to be applied when sending a message.
|
||||||
|
|
||||||
|
|
|
@ -478,7 +478,8 @@ the From: address."
|
||||||
(list (cons 'From (notmuch-mua-prompt-for-sender)))))
|
(list (cons 'From (notmuch-mua-prompt-for-sender)))))
|
||||||
forward-subject ;; Comes from the first message and is
|
forward-subject ;; Comes from the first message and is
|
||||||
;; applied later.
|
;; applied later.
|
||||||
forward-references) ;; List of accumulated message-references of forwarded messages
|
forward-references ;; List of accumulated message-references of forwarded messages
|
||||||
|
forward-queries) ;; List of corresponding message-query
|
||||||
|
|
||||||
;; Generate the template for the outgoing message.
|
;; Generate the template for the outgoing message.
|
||||||
(notmuch-mua-mail nil "" other-headers nil (notmuch-mua-get-switch-function))
|
(notmuch-mua-mail nil "" other-headers nil (notmuch-mua-get-switch-function))
|
||||||
|
@ -497,7 +498,8 @@ the From: address."
|
||||||
;; always generate a forwarded subject, then use the
|
;; always generate a forwarded subject, then use the
|
||||||
;; last (i.e. first) one.
|
;; last (i.e. first) one.
|
||||||
(setq forward-subject (message-make-forward-subject))
|
(setq forward-subject (message-make-forward-subject))
|
||||||
(push (message-fetch-field "Message-ID") forward-references))
|
(push (message-fetch-field "Message-ID") forward-references)
|
||||||
|
(push id forward-queries))
|
||||||
;; Make a copy ready to be forwarded in the
|
;; Make a copy ready to be forwarded in the
|
||||||
;; composition buffer.
|
;; composition buffer.
|
||||||
(message-forward-make-body temp-buffer)
|
(message-forward-make-body temp-buffer)
|
||||||
|
@ -516,6 +518,14 @@ the From: address."
|
||||||
(message-add-header (concat "References: "
|
(message-add-header (concat "References: "
|
||||||
(mapconcat 'identity forward-references " "))))
|
(mapconcat 'identity forward-references " "))))
|
||||||
|
|
||||||
|
;; Create a buffer-local queue for tag changes triggered when sending the message
|
||||||
|
(when notmuch-message-forwarded-tags
|
||||||
|
(setq-local notmuch-message-queued-tag-changes
|
||||||
|
(loop for id in forward-queries
|
||||||
|
collect
|
||||||
|
(cons id
|
||||||
|
notmuch-message-forwarded-tags))))
|
||||||
|
|
||||||
;; `message-forward-make-body' shows the User-agent header. Hide
|
;; `message-forward-make-body' shows the User-agent header. Hide
|
||||||
;; it again.
|
;; it again.
|
||||||
(message-hide-headers)
|
(message-hide-headers)
|
||||||
|
|
Loading…
Reference in a new issue