From 5300330a27ce64f43b0ed36a9fa0a49158d19c6a Mon Sep 17 00:00:00 2001 From: jao Date: Thu, 10 Nov 2022 21:33:14 +0000 Subject: email adjustments, and fcc in notmuch based on current folder --- lib/net/jao-notmuch.el | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'lib/net') 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) -- cgit v1.2.3