Function: message-insert-newsgroups

message-insert-newsgroups is an interactive and byte-compiled function defined in message.el.gz.

Signature

(message-insert-newsgroups)

Documentation

Insert the Newsgroups header from the article being replied to.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
(defun message-insert-newsgroups ()
  "Insert the Newsgroups header from the article being replied to."
  (interactive nil message-mode)
  (let ((old-newsgroups (mail-fetch-field "newsgroups"))
	(new-newsgroups (message-fetch-reply-field "newsgroups"))
	(first t)
	insert-newsgroups)
    (message-position-on-field "Newsgroups")
    (cond
     ((not new-newsgroups)
      (error "No Newsgroups to insert"))
     ((not old-newsgroups)
      (insert new-newsgroups))
     (t
      (setq new-newsgroups (split-string new-newsgroups "[, ]+")
	    old-newsgroups (split-string old-newsgroups "[, ]+"))
      (dolist (group new-newsgroups)
	(unless (member group old-newsgroups)
	  (push group insert-newsgroups)))
      (if (null insert-newsgroups)
	  (error "Newgroup%s already in the header"
		 (if (> (length new-newsgroups) 1)
		     "s" ""))
	(when old-newsgroups
	  (setq first nil))
	(dolist (group insert-newsgroups)
	  (unless first
	    (insert ","))
	  (setq first nil)
	  (insert group)))))))