- (when gnus-message-archive-method
- (unless (assoc "archive" gnus-server-alist)
- (let ((method (or (and (stringp gnus-message-archive-method)
- (gnus-server-to-method
- gnus-message-archive-method))
- gnus-message-archive-method)))
- ;; Check whether the archive method is writable.
- (unless (or (stringp method)
- (memq 'respool (assoc (format "%s" (car method))
- gnus-valid-select-methods)))
- (setq method "archive")) ;; The default.
- (push (if (stringp method)
- `("archive"
- nnfolder
- ,method
- (nnfolder-directory
- ,(nnheader-concat message-directory method))
- (nnfolder-active-file
- ,(nnheader-concat message-directory
- (concat method "/active")))
- (nnfolder-get-new-mail nil)
- (nnfolder-inhibit-expiry t))
- (cons "archive" method))
- gnus-server-alist))))
+ (let ((method (or (and (stringp gnus-message-archive-method)
+ (gnus-server-to-method
+ gnus-message-archive-method))
+ gnus-message-archive-method)))
+ ;; Check whether the archive method is writable.
+ (unless (or (not method)
+ (stringp method)
+ (memq 'respool (assoc (format "%s" (car method))
+ gnus-valid-select-methods)))
+ (setq method "archive")) ;; The default.
+ (when (stringp method)
+ (setq method `(nnfolder
+ ,method
+ (nnfolder-directory
+ ,(nnheader-concat message-directory method))
+ (nnfolder-active-file
+ ,(nnheader-concat message-directory
+ (concat method "/active")))
+ (nnfolder-get-new-mail nil)
+ (nnfolder-inhibit-expiry t))))
+ (if (assoc "archive" gnus-server-alist)
+ (when gnus-update-message-archive-method
+ (if method
+ (setcdr (assoc "archive" gnus-server-alist) method)
+ (setq gnus-server-alist (delq (assoc "archive" gnus-server-alist)
+ gnus-server-alist))))
+ (when method
+ (push (cons "archive" method) gnus-server-alist))))