]> git.eshelyaron.com Git - emacs.git/commitdiff
Strip most headers when forwarding messages
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 26 Apr 2018 17:45:53 +0000 (19:45 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 26 Apr 2018 17:47:48 +0000 (19:47 +0200)
* lisp/gnus/message.el (message-forward-included-headers): Change
the default to exclude most messages.
(message-remove-ignored-headers): Make
message-forward-included-headers actually work -- it's a list of
regexps, not a list of strings.

doc/misc/message.texi
etc/NEWS
lisp/gnus/message.el

index 1d27ff1c585476c6a956e6244ed39bc9316b416f..671a5214aec1ea4c845cf39df998d12222313bc0 100644 (file)
@@ -316,7 +316,7 @@ when forwarding a message.
 @item message-forward-included-headers
 @vindex message-forward-included-headers
 In non-@code{nil}, only headers that match this regexp will be kept
-when forwarding a message.
+when forwarding a message.  This can also be a list of regexps.
 
 @item message-make-forward-subject-function
 @vindex message-make-forward-subject-function
index 5416cb7c21594db6ec6fb587f7d4dcfc8d90cd2d..ca46c88ce62147151b3c4b127016d4a4266e229b 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -425,10 +425,15 @@ achieve this, add 'message-sign-encrypt-if-all-keys-available' to
 '"foo@bar.com" <foo@bar.com>', Message will elide the repeated "name"
 from the address field in the response.
 
+---
 *** The default of 'message-forward-as-mime' has changed from t to nil
 as it has been reported that many recipients can't read forwards that
 are formatted as MIME digests.
 
++++
+*** `message-forward-included-headers' has changed its default to
+exclude most headers when forwarding.
+
 * New Modes and Packages in Emacs 27.1
 
 +++
index 33c5e2cedbf6f0dd6181aac68f28f37e6857b690..867c3d271b64040f1d10766a5a4da785b343650d 100644 (file)
@@ -625,11 +625,12 @@ This may also be a list of regexps."
                              (widget-editable-list-match widget value)))
                 regexp))
 
-(defcustom message-forward-included-headers nil
+(defcustom message-forward-included-headers
+  '("^From:" "^Subject:" "^Date:")
   "If non-nil, delete non-matching headers when forwarding a message.
 Only headers that match this regexp will be included.  This
 variable should be a regexp or a list of regexps."
-  :version "25.1"
+  :version "27.1"
   :group 'message-forwarding
   :type '(repeat :value-to-internal (lambda (widget value)
                                      (custom-split-regexp-maybe value))
@@ -7436,7 +7437,8 @@ Optional DIGEST will use digest to forward."
       (when message-forward-included-headers
        (message-remove-header
         (if (listp message-forward-included-headers)
-            (regexp-opt message-forward-included-headers)
+            (mapconcat #'identity (cons "^$" message-forward-included-headers)
+                       "\\|")
           message-forward-included-headers)
         t nil t)))))