Function: gnus-agent-read-local

gnus-agent-read-local is a byte-compiled function defined in gnus-agent.el.gz.

Signature

(gnus-agent-read-local FILE)

Documentation

Load FILE and do a read there.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-agent.el.gz
(defun gnus-agent-read-local (file)
  "Load FILE and do a `read' there."
  (let ((hashtb (gnus-make-hashtable
		 (count-lines (point-min)
			      (point-max))))
        (line 1))
    (with-temp-buffer
      (condition-case nil
	  (let ((nnheader-file-coding-system gnus-agent-file-coding-system))
	    (nnheader-insert-file-contents file))
        (file-error))

      (goto-char (point-min))
      ;; Skip any comments at the beginning of the file (the only
      ;; place where they may appear)
      (while (= (following-char) ?\;)
        (forward-line 1)
        (setq line (1+ line)))

      (while (not (eobp))
        (condition-case err
            (let (group
                  min
                  max
                  (cur (current-buffer)))
              (setq group (read cur)
                    min (read cur)
                    max (read cur))

              (unless (stringp group)
                (setq group (symbol-name group)))

              ;; NOTE: The '+ 0' ensure that min and max are both numerics.
              (puthash group (cons (+ 0 min) (+ 0 max)) hashtb))
          (error
           (gnus-message 3 "Warning - invalid agent local: %s on line %d: %s"
                         file line (error-message-string err))))
        (forward-line 1)
        (setq line (1+ line))))

    (puthash "+dirty" nil hashtb)
    (puthash "+method" gnus-command-method hashtb)
    hashtb))