Function: gnus-inews-insert-gcc

gnus-inews-insert-gcc is a byte-compiled function defined in gnus-msg.el.gz.

Signature

(gnus-inews-insert-gcc &optional GROUP)

Documentation

Insert the Gcc to say where the article is to be archived.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-msg.el.gz
(defun gnus-inews-insert-gcc (&optional group)
  "Insert the Gcc to say where the article is to be archived."
  (let* ((group (or group gnus-newsgroup-name))
         (var gnus-message-archive-group)
	 (gcc-self-val
	  (and group (not (gnus-virtual-group-p group))
	       (gnus-group-find-parameter group 'gcc-self t)))
	 (gcc-self-get (lambda (gcc-self-val group)
			 (if (stringp gcc-self-val)
			     (if (string-search " " 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-search " " group)
				 (concat "\"" group "\"")
			       group)))))
	 result
	 (groups
	  (cond
	   ((null gnus-message-archive-method)
	    ;; Ignore.
	    nil)
	   ((stringp var)
	    ;; Just a single group.
	    (list var))
	   ((null var)
	    ;; We don't want this.
	    nil)
	   ((and (listp var) (stringp (car var)))
	    ;; A list of groups.
	    var)
	   ((functionp var)
	    ;; A function.
	    (funcall var group))
	   (group
	    ;; An alist of regexps/functions/forms.
	    (while (and var
			(not
			 (setq result
			       (cond
				((and group
				      (stringp (caar var)))
				 ;; Regexp.
				 (when (string-match (caar var) group)
				   (cdar var)))
				((and group
				      (functionp (car var)))
				 ;; Function.
				 (funcall (car var) group))
				(t
				 (eval (car var) t))))))
	      (setq var (cdr var)))
	    result)))
	 name)
    (when (and (or groups gcc-self-val)
	       (gnus-alive-p))
      (when (stringp groups)
	(setq groups (list groups)))
      (save-excursion
	(save-restriction
	  (message-narrow-to-headers)
	  (goto-char (point-max))
	  (insert "Gcc: ")
	  (if gcc-self-val
	      ;; Use the `gcc-self' param value instead.
	      (progn
		(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)))
	    ;; Use the list of groups.
	    (while (setq name (pop groups))
	      (let ((str (if (string-search ":" name)
			     name
			   (gnus-group-prefixed-name
			    name gnus-message-archive-method))))
		(insert (if (string-search " " str)
			    (concat "\"" str "\"")
			  str)))
	      (when groups
		(insert ",")))
	    (insert "\n")))))))