From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/86042 Path: news.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.gnus.general Subject: Re: [PATCH 0/2] two minor fixes for new/empty nnimap group handling Date: Wed, 08 Jul 2015 20:41:17 +0800 Message-ID: <87r3oin7o2.fsf@ericabrahamsen.net> References: <1435750676-710-1-git-send-email-bjorn@mork.no> <87y4itti71.fsf@uwo.ca> <878uaspts1.fsf@ericabrahamsen.net> <87io9va7f5.fsf@uwo.ca> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1436377642 26009 80.91.229.3 (8 Jul 2015 17:47:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Jul 2015 17:47:22 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M34277@lists.math.uh.edu Wed Jul 08 19:47:09 2015 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from lists1.math.uh.edu ([129.7.128.208]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZCtOs-0001fo-Ex for ding-account@gmane.org; Wed, 08 Jul 2015 19:44:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by lists1.math.uh.edu with smtp (Exim 4.85) (envelope-from ) id 1ZCtON-0001Ag-VE; Wed, 08 Jul 2015 12:44:20 -0500 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by lists1.math.uh.edu with esmtps (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.85) (envelope-from ) id 1ZCtOL-0001A9-Km for ding@lists.math.uh.edu; Wed, 08 Jul 2015 12:44:17 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.84) (envelope-from ) id 1ZCofT-0005zX-FN for ding@lists.math.uh.edu; Wed, 08 Jul 2015 07:41:40 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1ZCofS-0001rc-5c for ding@gnus.org; Wed, 08 Jul 2015 14:41:38 +0200 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZCofM-0007MP-Fa for ding@gnus.org; Wed, 08 Jul 2015 14:41:32 +0200 Original-Received: from 111.199.149.245 ([111.199.149.245]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Jul 2015 14:41:32 +0200 Original-Received: from eric by 111.199.149.245 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Jul 2015 14:41:32 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 144 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 111.199.149.245 User-Agent: Gnus/5.130014 (Ma Gnus v0.14) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:i6YYGtoFhtc3+Dcqubp/nWZD8Ns= X-Spam-Score: -0.4 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:86042 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Dan Christensen writes: > Eric Abrahamsen writes: > >> Dan Christensen writes: >> >>> I tried these two one-line patches, and they allowed me to use nnmairix >>> again, although it wasn't smooth. > > [...] > >> This patch might offer the right solution: the group creation process >> sets the subscription level for the new group. This triggers all the >> necessary processes (I think) to get the group noticed by Gnus, so it >> doesn't trigger errors or require you to manually enter it. > > [...] > > I tried your patch after unapplying Bjøjn Mork's patch, and I got the > same backtrace as usual, due to a nil value getting passed in. See > below. > > Then I tried applying both your patch and Mork's patch, and didn't see > any difference in behaviour compared to Mork's patch alone. I even > deleted the imap group that nnmairix uses for its storage, in the hopes > that this would cause your new code to run, and still saw no change. > I had to manually subscribe to the group and refresh it before the > nnmairix group could be entered. Hmm, I thought I replied to this earlier in the day, but it doesn't look like the message is there. I'm resending this just in case. It turned out that there are several issues at play, and the fact that nnmairix calls `nnimap-group-scan' with INFO set to nil means that Bjørn's approach is necessary no matter what. Anyway, here are a couple of new patches, I hope people will try them out! Eric --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Tell-Gnus-about-newly-created-imap-groups.patch >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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0002-Handle-nil-info-argument-to-nnimap-request-group.patch >From 127951fd7c8f95e62131cddb0f6badf5588b0452 Mon Sep 17 00:00:00 2001 From: Eric Abrahamsen Date: Wed, 8 Jul 2015 12:14:49 +0800 Subject: [PATCH 2/2] Handle nil info argument to nnimap-request-group * lisp/nnimap.el (nnimap-request-group): Some functions call this with the INFO argument set to nil. --- lisp/nnimap.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/nnimap.el b/lisp/nnimap.el index a1c2c1a..3c6df4d 100644 --- a/lisp/nnimap.el +++ b/lisp/nnimap.el @@ -803,6 +803,7 @@ textual parts.") nil group) server)) + (info (when info (list info))) active) (with-current-buffer nntp-server-buffer (when result @@ -810,8 +811,8 @@ textual parts.") (not (setq active (nth 2 (assoc group nnimap-current-infos))))) (let ((sequences (nnimap-retrieve-group-data-early - server (list info)))) - (nnimap-finish-retrieve-group-infos server (list info) sequences + server info))) + (nnimap-finish-retrieve-group-infos server info sequences t) (setq active (nth 2 (assoc group nnimap-current-infos))))) (erase-buffer) -- 2.4.5 --=-=-=--