[Gnus] Allow list-valued gcc-self group params

* lisp/gnus/gnus-msg.el (gnus-inews-insert-gcc):
  Allow `gcc-self' to be a list of groups and t.
* doc/misc/gnus.texi (Group Parameters):
  Document that `gcc-self' may also be a list.
This commit is contained in:
Tassilo Horn 2014-07-31 13:11:41 +00:00 committed by Katsumi Yamaoka
parent 21a7129a0b
commit def546a8b8
2 changed files with 29 additions and 19 deletions

View file

@ -2880,12 +2880,17 @@ news group.
@item gcc-self
@cindex gcc-self
If @code{(gcc-self . t)} is present in the group parameter list, newly
composed messages will be @code{Gcc}'d to the current group. If
composed messages will be @code{gcc}d to the current group. If
@code{(gcc-self . none)} is present, no @code{Gcc:} header will be
generated, if @code{(gcc-self . "string")} is present, this string will
be inserted literally as a @code{gcc} header. This parameter takes
precedence over any default @code{Gcc} rules as described later
(@pxref{Archived Messages}), with the exception for messages to resend.
generated, if @code{(gcc-self . "group")} is present, this string will
be inserted literally as a @code{Gcc:} header. It should be a group
name. The @code{gcc-self} value may also be a list of strings and
@code{t}, e.g., @code{(gcc-self "group1" "group2" t)} means to
@code{gcc} the newly composed message into the groups @code{"group1"}
and @code{"group2"}, and into the current group. The @code{gcc-self}
parameter takes precedence over any default @code{Gcc} rules as
described later (@pxref{Archived Messages}), with the exception for
messages to resend.
@strong{Caveat}: Adding @code{(gcc-self . t)} to the parameter list of
@code{nntp} groups (or the like) isn't valid. An @code{nntp} server

View file

@ -1726,7 +1726,20 @@ this is a reply."
(var (or gnus-outgoing-message-group gnus-message-archive-group))
(gcc-self-val
(and group (not (gnus-virtual-group-p group))
(gnus-group-find-parameter group 'gcc-self)))
(gnus-group-find-parameter group 'gcc-self t)))
(gcc-self-get (lambda (gcc-self-val group)
(if (stringp gcc-self-val)
(if (string-match " " gcc-self-val)
(concat "\"" gcc-self-val "\"")
gcc-self-val)
;; In nndoc groups, we use the parent group name
;; instead of the current group.
(let ((group (or (gnus-group-find-parameter
gnus-newsgroup-name 'parent-group)
group)))
(if (string-match " " group)
(concat "\"" group "\"")
group)))))
result
(groups
(cond
@ -1777,19 +1790,11 @@ this is a reply."
(if gcc-self-val
;; Use the `gcc-self' param value instead.
(progn
(insert
(if (stringp gcc-self-val)
(if (string-match " " gcc-self-val)
(concat "\"" gcc-self-val "\"")
gcc-self-val)
;; In nndoc groups, we use the parent group name
;; instead of the current group.
(let ((group (or (gnus-group-find-parameter
gnus-newsgroup-name 'parent-group)
group)))
(if (string-match " " group)
(concat "\"" group "\"")
group))))
(insert (if (listp gcc-self-val)
(mapconcat (lambda (val)
(funcall gcc-self-get val group))
gcc-self-val ", ")
(funcall gcc-self-get gcc-self-val group)))
(if (not (eq gcc-self-val 'none))
(insert "\n")
(gnus-delete-line)))