Provide option to forward Gnus messages with all (most) headers

Bug#67520

* lisp/gnus/gnus-msg.el (gnus-summary-mail-forward): Accept symbolic
prefix to let-bind message-forward-included-headers to nil, which will
include most original message headers in the forwarded copy.
(gnus-summary-post-forward): Corresponding arglist update.
This commit is contained in:
Eric Abrahamsen 2023-12-08 09:39:58 -08:00
parent 67654fe965
commit 75fd7550ed
2 changed files with 34 additions and 18 deletions

View file

@ -5868,15 +5868,23 @@ original message but ignore the @code{Reply-To} field
@findex gnus-summary-mail-forward
@c @icon{gnus-summary-mail-forward}
Forward the current article to some other person
(@code{gnus-summary-mail-forward}). If no prefix is given, the message
is forwarded according to the value of (@code{message-forward-as-mime})
and (@code{message-forward-show-mml}); if the prefix is 1, decode the
message and forward directly inline; if the prefix is 2, forward message
as an rfc822 @acronym{MIME} section; if the prefix is 3, decode message and
forward as an rfc822 @acronym{MIME} section; if the prefix is 4, forward message
directly inline; otherwise, the message is forwarded as no prefix given
but use the flipped value of (@code{message-forward-as-mime}). By
default, the forwarded message is inlined into the mail.
(@code{gnus-summary-mail-forward}). If no prefix is given, the
message is forwarded according to the value of
(@code{message-forward-as-mime}) and
(@code{message-forward-show-mml}); if the prefix is 1, decode the
message and forward directly inline; if the prefix is 2, forward
message as an rfc822 @acronym{MIME} section; if the prefix is 3,
decode message and forward as an rfc822 @acronym{MIME} section; if the
prefix is 4, forward message directly inline; otherwise, the message
is forwarded as no prefix given but use the negated value of
(@code{message-forward-as-mime}). By default, the forwarded message
is inlined into the mail.
Which headers from the original message are included in the forwarded
message is determined by options specific to @code{message-mode},
@pxref{Forwarding,,, message}. In addition, this command can be given
the symbolic prefix @samp{a}, using @kbd{M-i a}, to include most original
headers.
@item S m
@itemx m

View file

@ -1209,7 +1209,7 @@ The original article(s) will be yanked."
(gnus-summary-reply
(gnus-summary-work-articles n) t (gnus-summary-work-articles n)))
(defun gnus-summary-mail-forward (&optional arg post)
(defun gnus-summary-mail-forward (&optional arg all-headers post)
"Forward the current message(s) to another user.
If process marks exist, forward all marked messages;
if ARG is nil, see `message-forward-as-mime' and `message-forward-show-mml';
@ -1217,17 +1217,25 @@ if ARG is 1, decode the message and forward directly inline;
if ARG is 2, forward message as an rfc822 MIME section;
if ARG is 3, decode message and forward as an rfc822 MIME section;
if ARG is 4, forward message directly inline;
otherwise, use flipped `message-forward-as-mime'.
otherwise, use negated `message-forward-as-mime'.
If POST, post instead of mail.
For the \"inline\" alternatives, also see the variable
`message-forward-ignored-headers'."
(interactive "P" gnus-summary-mode)
If symbolic prefix ALL-HEADERS is the symbol `a', include all
original headers in the forwarded message, except those matching
`message-forward-ignored-headers'. Otherwise, include headers
based on the options `message-forward-included-headers',
`message-forward-ignored-headers', and potentially
`message-forward-included-mime-headers'."
(interactive (gnus-interactive "P\ny") gnus-summary-mode)
(if (cdr (gnus-summary-work-articles nil))
;; Process marks are given.
(gnus-uu-digest-mail-forward nil post)
;; No process marks.
(let ((message-forward-as-mime message-forward-as-mime)
(message-forward-show-mml message-forward-show-mml))
(message-forward-show-mml message-forward-show-mml)
(message-forward-included-headers
(if (eq all-headers 'a)
nil
message-forward-included-headers)))
(cond
((null arg))
((eq arg 1)
@ -1380,11 +1388,11 @@ composing a new message."
(forward-char 1))
(widen)))))
(defun gnus-summary-post-forward (&optional arg)
(defun gnus-summary-post-forward (&optional arg all-headers)
"Forward the current article to a newsgroup.
See `gnus-summary-mail-forward' for ARG."
(interactive "P" gnus-summary-mode)
(gnus-summary-mail-forward arg t))
(interactive (gnus-interactive "P\ny") gnus-summary-mode)
(gnus-summary-mail-forward arg all-headers t))
(defun gnus-summary-mail-crosspost-complaint (n)
"Send a complaint about crossposting to the current article(s)."