From: Tassilo Horn Date: Thu, 31 Jul 2014 13:11:41 +0000 (+0000) Subject: [Gnus] Allow list-valued gcc-self group params X-Git-Tag: emacs-25.0.90~2636^3~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=def546a8b82f60478c780bf3cbdbceedcf7a2ccd;p=emacs.git [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. --- diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi index 80c1cc2ef03..a25d7c540f3 100644 --- a/doc/misc/gnus.texi +++ b/doc/misc/gnus.texi @@ -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 diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 469b9d2cf81..8b9842918da 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -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)))