Function: gnus-group-set-info

gnus-group-set-info is an autoloaded and byte-compiled function defined in gnus-group.el.gz.

Signature

(gnus-group-set-info INFO &optional METHOD-ONLY-GROUP PART)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-group.el.gz
(defun gnus-group-set-info (info &optional method-only-group part)
  (when (or info part)
    (let* ((entry (gnus-group-entry
		   (or method-only-group (gnus-info-group info))))
	   (part-info info)
	   (info (if method-only-group (nth 1 entry) info))
	   method)
      (when method-only-group
	(unless entry
	  (error "Trying to change non-existent group %s" method-only-group))
	;; We have received parts of the actual group info - either the
	;; select method or the group parameters.  We first check
	;; whether we have to extend the info, and if so, do that.
	(let ((len (length info))
	      (total (if (eq part 'method) 5 6)))
	  (when (< len total)
	    (setcdr (nthcdr (1- len) info)
		    (make-list (- total len) nil)))
	  ;; Then we enter the new info.
	  (setcar (nthcdr (1- total) info) part-info)))
      (unless entry
	;; This is a new group, so we just create it.
	(with-current-buffer gnus-group-buffer
	  (setq method (gnus-info-method info))
	  (when (gnus-server-equal method "native")
	    (setq method nil))
	  (with-current-buffer gnus-group-buffer
	    (if method
		;; It's a foreign group...
		(gnus-group-make-group
		 (gnus-group-real-name (gnus-info-group info))
		 (if (stringp method) method
		   (prin1-to-string (car method)))
		 (and (consp method)
		      (nth 1 (gnus-info-method info)))
		 nil)
	      ;; It's a native group.
	      (gnus-group-make-group (gnus-info-group info) nil nil nil)))
	  (gnus-message 6 "Note: New group created")
	  (setq entry
		(gnus-group-entry (gnus-group-prefixed-name
				   (gnus-group-real-name (gnus-info-group info))
				   (or (gnus-info-method info) gnus-select-method))))))
      ;; Whether it was a new group or not, we now have the entry, so we
      ;; can do the update.
      (if entry
	  (progn
	    (setcar (nthcdr 1 entry) info)
	    (when (and (not (eq (car entry) t))
		       (gnus-active (gnus-info-group info)))
	      (setcar entry (length
			     (gnus-list-of-unread-articles (car info)))))
	    ;; The above `setcar' will only affect the hashtable, not
	    ;; the alist: update the alist separately, but only if
	    ;; it's been initialized.
	    (when gnus-newsrc-alist
	      (push info (cdr (setq gnus-newsrc-alist
				    (remove (assoc-string
					     (gnus-info-group info)
					     gnus-newsrc-alist)
					    gnus-newsrc-alist))))))
	(error "No such group: %s" (gnus-info-group info))))))