summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-08-04 15:24:57 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-08-05 11:39:14 -0700
commit69558056f82ab0dcd55293266f2fde258dd1c343 (patch)
tree32ff5b6b68fd693beef598cdf3bad74ecc4e8e63
parent64bce8b846026df57e355adbfd98091fdb6e7780 (diff)
downloaddotfiles-69558056f82ab0dcd55293266f2fde258dd1c343.tar.gz
remove X-TUID, Date and User-Agent when resending
-rw-r--r--.emacs.d/init.el11
1 files changed, 11 insertions, 0 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el
index 652874bb..94b02c59 100644
--- a/.emacs.d/init.el
+++ b/.emacs.d/init.el
@@ -278,6 +278,8 @@ windows side-by-side in the frame."
'(message-forward-before-signature nil nil nil "For compatibility.")
'(message-forward-included-headers
'("^From:" "^Subject:" "^Date:" "^To:" "^Cc:" "^Message-ID:") nil nil "For compatibility.")
+ '(message-ignored-resent-headers
+ "^Return-receipt\\|^X-Gnus\\|^Gnus-Warning:\\|^>?From \\|^Delivered-To:\\|^X-Content-Length:\\|^X-UIDL:\\|^X-TUID:")
'(message-make-forward-subject-function '(message-forward-subject-fwd) nil nil "For compatibility.")
'(message-sendmail-envelope-from 'header nil nil "Bypass MTA rewriting user@localhost.")
'(message-wash-forwarded-subjects t)
@@ -2633,6 +2635,15 @@ mutt's review view, after exiting EDITOR."
(while (looking-at re)
(delete-region (point) (1+ (line-end-position))))))))
+;; `message-ignored-resent-headers' removes X-TUID, but we want to remove
+;; User-Agent & Date only when we're editing the message to be resent; I use
+;; `gnus-summary-resend-message-edit' only for composing mail using an old
+;; message as a template ("edit as new"), not actually editing and resending.
+(defun spw/gnus-summary-resend-message-edit ()
+ (message-remove-header "^Date:\\|^User-Agent:" t))
+(advice-add 'gnus-summary-resend-message-edit
+ :after #'spw/gnus-summary-resend-message-edit)
+
(with-eval-after-load 'message
(spw/when-library-available message-templ
(define-key message-mode-map [f7] #'spw/unfinalise-message)