Function: gnus-agent-save-group-info

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

Signature

(gnus-agent-save-group-info METHOD GROUP ACTIVE)

Documentation

Update single group's active range in agent's copy of server's active file.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-agent.el.gz
(defun gnus-agent-save-group-info (method group active)
  "Update single group's active range in agent's copy of server's active file."
  (when (gnus-agent-method-p method)
    (let* ((gnus-command-method (or method gnus-command-method))
	   (coding-system-for-write nnheader-file-coding-system)
	   (file-name-coding-system nnmail-pathname-coding-system)
	   (file (gnus-agent-lib-file "active"))
	   oactive-min oactive-max)
      (gnus-make-directory (file-name-directory file))
      (with-temp-file file
	;; Emacs got problem to match non-ASCII group in multibyte buffer.

	;; FIXME: Is this still an issue now that group names are
	;; always strings?
	;(mm-disable-multibyte)
	(when (file-exists-p file)
	  (nnheader-insert-file-contents file)

          (goto-char (point-min))
          (when (re-search-forward
                 (concat "^" (regexp-quote group) " ") nil t)
            (save-excursion
              (setq oactive-max (read (current-buffer))	  ;; max
                    oactive-min (read (current-buffer)))) ;; min
            (gnus-delete-line)))
	(when active
	  (insert (format "%s %d %d y\n" group
			  (max (or oactive-max (cdr active)) (cdr active))
			  (min (or oactive-min (car active)) (car active))))
	  (goto-char (point-max))
	  (while (search-backward "\\." nil t)
	    (delete-char 1)))))))