parse-time.el: Use cl-lib as much as possible following the 2014-09-26 change in...
[gnus] / lisp / gnus-msg.el
index 1c8635c..8b98429 100644 (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)))
@@ -1826,7 +1831,7 @@ this is a reply."
                      (with-current-buffer gnus-summary-buffer
                        gnus-posting-styles)
                    gnus-posting-styles))
-         style match attribute value v results
+         style match attribute value v results matched-string
          filep name address element)
       ;; If the group has a posting-style parameter, add it at the end with a
       ;; regexp matching everything, to be sure it takes precedence over all
@@ -1846,7 +1851,9 @@ this is a reply."
        (when (cond
               ((stringp match)
                ;; Regexp string match on the group name.
-               (string-match match group))
+               (when (string-match match group)
+                  (setq matched-string group)
+                  t))
               ((eq match 'header)
                ;; Obsolete format of header match.
                (and (gnus-buffer-live-p gnus-article-copy)
@@ -1875,7 +1882,8 @@ this is a reply."
                           (nnheader-narrow-to-headers)
                           (let ((header (message-fetch-field (nth 1 match))))
                             (and header
-                                 (string-match (nth 2 match) header)))))))
+                                 (string-match (nth 2 match) header)
+                                 (setq matched-string header)))))))
                 (t
                  ;; This is a form to be evalled.
                  (eval match)))))
@@ -1896,10 +1904,11 @@ this is a reply."
            (setq v
                  (cond
                   ((stringp value)
-                   (if (and (stringp match)
+                   (if (and matched-string
                             (gnus-string-match-p "\\\\[&[:digit:]]" value)
                             (match-beginning 1))
-                       (gnus-match-substitute-replacement value nil nil group)
+                       (gnus-match-substitute-replacement value nil nil
+                                                          matched-string)
                      value))
                   ((or (symbolp value)
                        (functionp value))