summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/net/jao-notmuch.el16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index 48a8ff8..1e9eb4c 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -1,4 +1,4 @@
-;; jao-notmuch.el --- Extensions for notmuch -*- lexical-binding: t; -*-
+;;; jao-notmuch.el --- Extensions for notmuch -*- lexical-binding: t; -*-
;; Copyright (C) 2021, 2022 jao
@@ -328,6 +328,7 @@
(let ((tags (plist-get (notmuch-tree-get-message-properties) :orig-tags)))
(jao-notmuch-tree--tag tags nil)))
+;;; fcc
(defvar jao-notmuch-mua-reply-not-inherited
'("attachment" "sent" "new" "bigml" "jao" "trove"))
@@ -342,9 +343,20 @@
(fcc-dirs (assoc-delete-all ".*" (copy-alist notmuch-fcc-dirs))))
(append fcc-dirs `((".*" . ,fcc)))))
+(defun jao-notmuch-mua--inherited-fcc ()
+ (let* ((fn (notmuch-show-get-filename))
+ (dest (and (string-match ".*/var/mail/\\(.+?\\)/.+" fn)
+ (match-string 1 fn)))
+ (tags (seq-difference (notmuch-show-get-tags)
+ '("attachment" "sent" "new" "flagged")))
+ (tagstr (mapconcat (lambda (s) (concat "+" s)) tags " "))
+ (fcc (concat dest " " tagstr " -new +sent +trove"))
+ (fcc-dirs (assoc-delete-all ".*" (copy-alist notmuch-fcc-dirs))))
+ (append fcc-dirs `((".*" . ,fcc)))))
+
(defun jao-notmuch-mua-new-reply (fun &rest args)
(let ((notmuch-fcc-dirs (and (not (notmuch-show-get-header :List-Id))
- (jao-notmuch-mua--fcc-dirs))))
+ (jao-notmuch-mua--inherited-fcc))))
(apply fun args)))
(advice-add 'notmuch-mua-new-reply :around #'jao-notmuch-mua-new-reply)