From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/86039 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 12:20:52 +0800 Message-ID: <87zj37nuu3.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 1436373248 15078 80.91.229.3 (8 Jul 2015 16:34:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Jul 2015 16:34:08 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M34274@lists.math.uh.edu Wed Jul 08 18:33:54 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 1ZCsID-0006Ho-4w for ding-account@gmane.org; Wed, 08 Jul 2015 18:33:53 +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 1ZCsHL-0000he-FR; Wed, 08 Jul 2015 11:32:59 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by lists1.math.uh.edu with esmtps (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.85) (envelope-from ) id 1ZCsHH-0000hF-B6 for ding@lists.math.uh.edu; Wed, 08 Jul 2015 11:32:55 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.84) (envelope-from ) id 1ZCgxC-0000bJ-IO for ding@lists.math.uh.edu; Tue, 07 Jul 2015 23:27:27 -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 1ZCgxA-0006Ro-L0 for ding@gnus.org; Wed, 08 Jul 2015 06:27:24 +0200 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZCgx0-0008Mb-7Q for ding@gnus.org; Wed, 08 Jul 2015 06:27:14 +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 06:27:14 +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 06:27:14 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 147 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:sjyuaSGTYxZPrnXIj/iMZETEa+8= X-Spam-Score: -0.6 (/) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:86039 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. > > Thanks for the help so far! Ha, well that was a bust, wasn't it? Turns out there were multiple issues here -- the patch I sent fixed group creation via moving messages, but nnmairix calls `nnimap-request-group' with INFO set to nil, so Bjørn's solution was still necessary. I've made some more adjustments to the group creation process, which I hope won't mess anything else up. Would you mind trying these two patches? Thanks, 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 --=-=-=--