[PATCH] emacs: fcc-insert: mark read when inserting

Mark Walters markwalters1009 at gmail.com
Mon Oct 3 11:30:05 PDT 2016


Apply the mark read tags when inserting. These can be overridden by
the user specified tags on the fcc line.

The full ordering is

1) the normal "new" tags applied according to notmuch-config
2) the tags in notmuch-show-mark-read
3) any user tags on the fcc line
---

On irc amdragon suggested that we should not add the unread tag to
sent messages fcc'd by notmuch insert. This does this. The slight
complication is that the unread tag (or more accurately the tag change
to apply when a message is read) is customisable. Thus we apply the
tag change to the inserted message. This can be over-ridden by the
user (eg specifying "+unread" on the fcc line).

We could apply the archive tags at the same time but that seemed more
controversial, so is not done here.

Note this is not heavily tested, but seems to work.

Best wishes

Mark


emacs/notmuch-maildir-fcc.el | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-maildir-fcc.el b/emacs/notmuch-maildir-fcc.el
index 95e5650..8d444d9 100644
--- a/emacs/notmuch-maildir-fcc.el
+++ b/emacs/notmuch-maildir-fcc.el
@@ -27,6 +27,9 @@
 
 (require 'notmuch-lib)
 
+;; The following variable is defined in notmuch-show
+(defvar notmuch-show-mark-read-tags)
+
 (defvar notmuch-maildir-fcc-count 0)
 
 (defcustom notmuch-fcc-dirs "sent"
@@ -230,11 +233,13 @@ should be a list of tag changes to apply to the inserted message."
 The fcc-header should be of the form \"folder +tag1 -tag2\" where
 folder is the folder (relative to the notmuch mailstore) to store
 the message in, and tag1 and tag2 are tag changes to apply to the
-stored message. If CREATE is non-nil then create the folder if
-necessary."
+stored message. These tag changes are applied after both the
+normal notmuch insert tag changes, and the tag changes in
+`notmuch-show-mark-read-tags' are applied.  If CREATE is non-nil
+then create the folder if necessary."
   (let* ((args (split-string-and-unquote fcc-header))
 	 (folder (car args))
-	 (tags (cdr args)))
+	 (tags (append notmuch-show-mark-read-tags (cdr args))))
     (condition-case nil
 	(notmuch-maildir-notmuch-insert-current-buffer folder create tags)
       ;; Since there are many reasons notmuch insert could fail, e.g.,
-- 
2.1.4



More information about the notmuch mailing list