- (gnus-make-directory (file-name-directory file))
- (let ((coding-system-for-write gnus-agent-article-file-coding-system))
- (write-region (point-min) (point-max) file nil 'silent))
- (when (file-exists-p (gnus-agent-lib-file "groups"))
- (delete-file (gnus-agent-lib-file "groups"))))))
+ (funcall function nil new)
+ (gnus-agent-write-active file new)
+ (erase-buffer)
+ (insert-file-contents-literally file))))
+
+(defun gnus-agent-write-active (file new)
+ (let ((orig (gnus-make-hashtable (count-lines (point-min) (point-max))))
+ (file (gnus-agent-lib-file "active"))
+ elem osym)
+ (when (file-exists-p file)
+ (with-temp-buffer
+ (insert-file-contents file)
+ (gnus-active-to-gnus-format nil orig))
+ (mapatoms
+ (lambda (sym)
+ (when (and sym (boundp sym))
+ (if (and (boundp (setq osym (intern (symbol-name sym) orig)))
+ (setq elem (symbol-value osym)))
+ (setcdr elem (cdr (symbol-value sym)))
+ (set (intern (symbol-name sym) orig) (symbol-value sym)))))
+ new))
+ (gnus-make-directory (file-name-directory file))
+ (let ((coding-system-for-write gnus-agent-file-coding-system))
+ (gnus-write-active-file file orig))))