- (when group
- (save-excursion
- ;; Find the next article number in GROUP.
- (prog1
- (let ((active (cadr (assoc group nnfolder-group-alist))))
- (if active
- (setcdr active (1+ (cdr active)))
- ;; This group is new, so we create a new entry for it.
- ;; This might be a bit naughty... creating groups on the drop of
- ;; a hat, but I don't know...
- (push (list group (setq active (cons 1 1)))
- nnfolder-group-alist))
- (cdr active))
- (nnmail-save-active nnfolder-group-alist nnfolder-active-file)
- (nnfolder-possibly-activate-groups group)))))
-
+ ;; Find the next article number in GROUP.
+ (let ((active (cadr (assoc group nnfolder-group-alist))))
+ (if active
+ (setcdr active (1+ (cdr active)))
+ ;; This group is new, so we create a new entry for it.
+ ;; This might be a bit naughty... creating groups on the drop of
+ ;; a hat, but I don't know...
+ (push (list group (setq active (cons 1 1)))
+ nnfolder-group-alist))
+ (cdr active)))
+
+(defun nnfolder-possibly-change-folder (group)
+ (let ((inf (assoc group nnfolder-buffer-alist)))
+ (if (and inf
+ (gnus-buffer-live-p (cadr inf)))
+ (set-buffer (cadr inf))
+ (when inf
+ (setq nnfolder-buffer-alist (delq inf nnfolder-buffer-alist)))
+ (when nnfolder-group-alist
+ (nnmail-save-active nnfolder-group-alist nnfolder-active-file))
+ (push (list group (nnfolder-read-folder group))
+ nnfolder-buffer-alist))))