Function: gnus-update-format-specifications

gnus-update-format-specifications is a byte-compiled function defined in gnus-spec.el.gz.

Signature

(gnus-update-format-specifications &optional FORCE &rest TYPES)

Documentation

Update all (necessary) format specifications.

Return a list of updated types.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-spec.el.gz
(defun gnus-update-format-specifications (&optional force &rest types)
  "Update all (necessary) format specifications.
Return a list of updated types."
  ;; Make the indentation array.
  ;; See whether all the stored info needs to be flushed.
  (when (or force
	    (not gnus-newsrc-file-version)
	    (not (equal (gnus-continuum-version)
			(gnus-continuum-version gnus-newsrc-file-version)))
	    (not (equal emacs-version
			(cdr (assq 'version gnus-format-specs)))))
    (setq gnus-format-specs nil))
  ;; Go through all the formats and see whether they need updating.
  (let (new-format entry type val updated)
    (while (setq type (pop types))
      ;; Jump to the proper buffer to find out the value of the
      ;; variable, if possible.  (It may be buffer-local.)
      (save-current-buffer
	(let ((buffer (intern (format "gnus-%s-buffer" type))))
	  (when (and (boundp buffer)
		     (setq val (symbol-value buffer))
                     (gnus-buffer-live-p val))
	    (set-buffer val)))
	(setq new-format (symbol-value
			  (intern (format "gnus-%s-line-format" type))))
	(setq entry (cdr (assq type gnus-format-specs)))
	(if (and (car entry)
		 (equal (car entry) new-format))
	    ;; Use the old format.
	    (set (intern (format "gnus-%s-line-format-spec" type))
		 (cadr entry))
	  ;; This is a new format.
	  (setq val
		(if (not (stringp new-format))
		    ;; This is a function call or something.
		    new-format
		  ;; This is a "real" format.
		  (gnus-parse-format
		   new-format
		   (symbol-value
		    (intern (format "gnus-%s-line-format-alist" type)))
		   (not (string-match "mode\\'" (symbol-name type))))))
	  ;; Enter the new format spec into the list.
	  (if entry
	      (progn
		(setcar (cdr entry) val)
		(setcar entry new-format))
	    (push (list type new-format val) gnus-format-specs))
	  (set (intern (format "gnus-%s-line-format-spec" type)) val)
	  (push type updated))))

    (unless (assq 'version gnus-format-specs)
      (push (cons 'version emacs-version) gnus-format-specs))
    updated))