Function: gnus-gnus-to-newsrc-format
gnus-gnus-to-newsrc-format is an interactive and byte-compiled
function defined in gnus-start.el.gz.
Signature
(gnus-gnus-to-newsrc-format &optional FOREIGN-OK)
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-start.el.gz
(defun gnus-gnus-to-newsrc-format (&optional foreign-ok)
(interactive (list (gnus-y-or-n-p "Write foreign groups too?")))
;; Generate and save the .newsrc file.
(with-current-buffer (create-file-buffer gnus-current-startup-file)
(let ((standard-output (current-buffer))
(groups (delete "dummy.group" (copy-sequence gnus-group-list)))
info ranges range method)
(setq buffer-file-name gnus-current-startup-file)
(setq default-directory (file-name-directory buffer-file-name))
(buffer-disable-undo)
(erase-buffer)
;; Write options.
(when gnus-newsrc-options
(insert gnus-newsrc-options))
;; Write subscribed and unsubscribed.
(dolist (g-name groups)
(setq info (nth 1 (gnus-group-entry g-name)))
;; Maybe don't write foreign groups to .newsrc.
(when (or (null (setq method (gnus-info-method info)))
(equal method "native")
(inline (gnus-server-equal method gnus-select-method))
foreign-ok)
(insert g-name
(if (> (gnus-info-level info) gnus-level-subscribed)
"!" ":"))
(when (setq ranges (gnus-info-read info))
(insert " ")
(if (not (listp (cdr ranges)))
(if (= (car ranges) (cdr ranges))
(princ (car ranges))
(princ (car ranges))
(insert "-")
(princ (cdr ranges)))
(while (setq range (pop ranges))
(if (or (atom range) (= (car range) (cdr range)))
(princ (or (and (atom range) range) (car range)))
(princ (car range))
(insert "-")
(princ (cdr range)))
(when ranges
(insert ",")))))
(insert "\n")))
(setq-local version-control 'never)
;; It has been reported that sometime the modtime on the .newsrc
;; file seems to be off. We really do want to overwrite it, so
;; we clear the modtime here before saving. It's a bit odd,
;; though...
;; sometimes the modtime clear isn't sufficient. most brute force:
;; delete the silly thing entirely first. but this fails to provide
;; such niceties as .newsrc~ creation.
(if gnus-modtime-botch
(delete-file gnus-startup-file)
(clear-visited-file-modtime))
(gnus-run-hooks 'gnus-save-standard-newsrc-hook)
(let ((coding-system-for-write 'raw-text))
(save-buffer))
(kill-buffer (current-buffer)))))