summaryrefslogtreecommitdiffhomepage
path: root/lib/net
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-05-25 23:22:47 +0100
committerjao <jao@gnu.org>2022-05-25 23:22:47 +0100
commit2f041bda5cedfdce0a6a8b3599d1f6f779764619 (patch)
treecce4152bc8fb6f1a472c5fea38cea1c5b78a647a /lib/net
parentbdbd41bcfa27184290eb8ffde6c5d7d3052f8079 (diff)
downloadelibs-2f041bda5cedfdce0a6a8b3599d1f6f779764619.tar.gz
elibs-2f041bda5cedfdce0a6a8b3599d1f6f779764619.tar.bz2
jao-notmuch: inheriting original's tags in replies
Diffstat (limited to 'lib/net')
-rw-r--r--lib/net/jao-notmuch.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el
index bd48e8f..6344eab 100644
--- a/lib/net/jao-notmuch.el
+++ b/lib/net/jao-notmuch.el
@@ -414,6 +414,24 @@
(jao-notmuch-tree--tag tags nil nil)
(jao-notmuch-tree--next nil nil t t)))
+(defvar jao-notmuch-mua-reply-not-inherited
+ '("attachment" "sent" "new" "unread"))
+
+(defun jao-notmuch--append-to-fcc (suffix)
+ (mapcar (lambda (e)
+ (let ((r (cdr e)))
+ (if (stringp r) (cons (car e) (concat r " " suffix)) e)))
+ notmuch-fcc-dirs))
+
+(defun jao-notmuch-mua-new-reply (fun &rest args)
+ (let* ((tags (seq-difference (notmuch-show-get-tags)
+ jao-notmuch-mua-reply-not-inherited))
+ (tagstr (mapconcat (lambda (s) (concat "+" s)) tags " "))
+ (notmuch-fcc-dirs (jao-notmuch--append-to-fcc tagstr)))
+ (apply fun args)))
+
+(advice-add 'notmuch-mua-new-reply :around #'jao-notmuch-mua-new-reply)
+
;;;; Results formatters