Function: gnus-gnus-to-quick-newsrc-format

gnus-gnus-to-quick-newsrc-format is a byte-compiled function defined in gnus-start.el.gz.

Signature

(gnus-gnus-to-quick-newsrc-format &optional MINIMAL NAME &rest SPECIFIC-VARIABLES)

Documentation

Print Gnus variables such as gnus-newsrc-alist in Lisp format.

Unless optional argument MINIMAL is non-nil, print human-readable information in the header of the file, including the file version. If NAME is present, print that as part of the header.

Variables printed are either the variables specified in SPECIFIC-VARIABLES, or those in gnus-variable-list.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-start.el.gz
(defun gnus-gnus-to-quick-newsrc-format (&optional minimal name &rest specific-variables)
  "Print Gnus variables such as `gnus-newsrc-alist' in Lisp format.
Unless optional argument MINIMAL is non-nil, print human-readable
information in the header of the file, including the file
version.  If NAME is present, print that as part of the header.

Variables printed are either the variables specified in
SPECIFIC-VARIABLES, or those in `gnus-variable-list'."
    (princ (format ";; -*- mode:emacs-lisp; coding: %s; -*-\n"
		   gnus-ding-file-coding-system))
    (princ (if name
	       (format ";; %s\n" name)
	     ";; Gnus startup file.\n"))

    (unless minimal
      (princ "\
;; Never delete this file -- if you want to force Gnus to read the
;; .newsrc file (if you have one), touch .newsrc instead.\n")
      (princ "(setq gnus-newsrc-file-version ")
      (princ (gnus-prin1-to-string gnus-version))
      (princ ")\n"))
    (let* ((print-quoted t)
           (print-escape-multibyte nil)
           (print-escape-nonascii t)
           (print-length nil)
           (print-level nil)
	   (print-circle nil)
           (print-escape-newlines t)
	   (gnus-killed-list
	    (if (and gnus-save-killed-list
		     (stringp gnus-save-killed-list))
		(gnus-strip-killed-list)
	      gnus-killed-list))
	   (variables
	    (or specific-variables
		(if gnus-save-killed-list gnus-variable-list
		  ;; Remove the `gnus-killed-list' from the list of variables
		  ;; to be saved, if required.
		  (delq 'gnus-killed-list (copy-sequence gnus-variable-list)))))
           ;; Sort `gnus-newsrc-alist' according to order in
           ;; `gnus-group-list'.  Encode group names in
           ;; `gnus-newsrc-alist' and `gnus-topic-alist' in order to
           ;; keep newsrc.eld files compatible with older versions of
           ;; Gnus.  At some point, if/when a new version of Gnus is
           ;; released, stop doing this and move the corresponding
           ;; decode in `gnus-read-newsrc-el-file' into a conversion
           ;; routine.
	   (gnus-newsrc-alist
	    (mapcar (lambda (group)
		      (cons (encode-coding-string group 'utf-8-emacs)
			    (cdadr (gethash group
			    gnus-newsrc-hashtb))))
		    (remove "dummy.group" gnus-group-list)))
	   (gnus-topic-alist
	    (when (memq 'gnus-topic-alist variables)
	     (mapcar (lambda (elt)
		       (cons (car elt) ; Topic name
			     (mapcar (lambda (g)
				       (encode-coding-string
					g 'utf-8-emacs))
				     (cdr elt))))
		     gnus-topic-alist)))
	   variable)
      ;; Insert the variables into the file.
      (while variables
	(when (and (boundp (setq variable (pop variables)))
		   (symbol-value variable))
	  (princ "\n(setq ")
          (princ (symbol-name variable))
          (princ " '")
	  (prin1 (symbol-value variable))
	  (princ ")\n")))))