summaryrefslogtreecommitdiffhomepage
path: root/email.org
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-06-04 03:10:56 +0100
committerjao <jao@gnu.org>2022-06-04 03:11:37 +0100
commitdf950ad48cbd7998114229b5f6966e00a87d4c78 (patch)
treec2b34f7897f174b1a37e0fa4af2ddb09b3a6ee9f /email.org
parentdd62a05f8f189f71c2106696972891ee2edaecb6 (diff)
downloadelibs-df950ad48cbd7998114229b5f6966e00a87d4c78.tar.gz
elibs-df950ad48cbd7998114229b5f6966e00a87d4c78.tar.bz2
email: sneak message-dont-reply-to-names in notmuch-mua
Diffstat (limited to 'email.org')
-rw-r--r--email.org25
1 files changed, 22 insertions, 3 deletions
diff --git a/email.org b/email.org
index a4592e2..3d57d0c 100644
--- a/email.org
+++ b/email.org
@@ -63,7 +63,7 @@
(setq message-expand-name-standard-ui t)
#+end_src
-*** To->From and Bcc
+*** Adjust Bcc
#+begin_src emacs-lisp
(defvar jao-message--bcc-rx (regexp-opt '("mail.io" "gnu.org")))
@@ -73,7 +73,9 @@
(insert "Bcc: proton@jao.io\n"))))
(add-hook 'message-header-setup-hook #'jao-message-insert-bcc)
-
+ #+end_src
+*** To->From and Bcc
+ #+begin_src emacs-lisp
(defvar jao-message-to-from nil)
(defun jao-message-adjust-from ()
@@ -85,7 +87,24 @@
(widen)
(message-replace-header "From" from)))))
- (add-hook 'message-header-setup-hook #'jao-message-adjust-from)
+ (when jao-notmuch-enabled
+ (add-hook 'message-header-setup-hook #'jao-message-adjust-from))
+ #+end_src
+*** Clean-up reply addresses
+ #+begin_src emacs-lisp
+ (defun jao-message--dont-reply (mail)
+ (unless (string-match-p message-dont-reply-to-names mail) mail))
+
+ (defun jao-message-strip-replies ()
+ (dolist (header '("To" "Cc"))
+ (when-let ((v (message-fetch-field header)))
+ (let* ((v (message-tokenize-header v))
+ (vs (delq nil (mapcar #'jao-message--dont-reply v)))
+ (v (when vs (mapconcat #'string-trim vs ", "))))
+ (message-replace-header header v)))))
+
+ (when jao-notmuch-enabled
+ (add-hook 'message-setup-hook #'jao-message-strip-replies))
#+end_src
*** Encryption