From 175107159bd61cf961eb39983f61d33925febb9c Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Tue, 7 Jul 2015 10:39:37 +0800 Subject: [PATCH 1/2] Tell Gnus about newly-created imap groups * lisp/nnimap.el (nnimap-request-create-group): Upon successful creation, register the new group with Gnus. (nnimap-request-group-scan): Update/store group info even if marks are nil, this is necessary for newly-created groups. --- lisp/nnimap.el | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lisp/nnimap.el b/lisp/nnimap.el index 40610e1..a1c2c1a 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -839,8 +839,7 @@ textual parts.") (nnimap-parse-flags (list (list group-sequence flag-sequence 1 group "SELECT"))))) - (when (and info - marks) + (when info (nnimap-update-infos marks (list info)) (nnimap-store-info info (gnus-active (gnus-info-group info)))) (goto-char (point-max)) @@ -861,7 +860,19 @@ textual parts.") (setq group (nnimap-decode-gnus-group group)) (when (nnimap-change-group nil server) (with-current-buffer (nnimap-buffer) - (car (nnimap-command "CREATE %S" (utf7-encode group t)))))) + (when (car (nnimap-command "CREATE %S" (utf7-encode group t))) + (let* ((method (gnus-server-to-method + (format "nnimap:%s" server))) + (qualname (gnus-group-prefixed-name + group method)) + (sub-level + (if (eq (gnus-matches-options-n qualname) 'subscribe) + gnus-level-default-subscribed + gnus-level-default-unsubscribed))) + (unless (gnus-group-entry qualname) + (gnus-group-change-level qualname sub-level)) + (nnimap-request-group-scan qualname server (gnus-get-info qualname)) + t))))) (deffoo nnimap-request-delete-group (group &optional force server) (setq group (nnimap-decode-gnus-group group)) -- 2.4.5