Gnus development mailing list
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: ding@gnus.org
Subject: Re: [PATCH 0/2] two minor fixes for new/empty nnimap group handling
Date: Wed, 08 Jul 2015 12:20:52 +0800	[thread overview]
Message-ID: <87zj37nuu3.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87io9va7f5.fsf@uwo.ca>

[-- Attachment #1: Type: text/plain, Size: 1542 bytes --]

Dan Christensen <jdc@uwo.ca> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Dan Christensen <jdc@uwo.ca> 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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Tell-Gnus-about-newly-created-imap-groups.patch --]
[-- Type: text/x-diff, Size: 1905 bytes --]

From 175107159bd61cf961eb39983f61d33925febb9c Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Handle-nil-info-argument-to-nnimap-request-group.patch --]
[-- Type: text/x-diff, Size: 1171 bytes --]

From 127951fd7c8f95e62131cddb0f6badf5588b0452 Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
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


  reply	other threads:[~2015-07-08  4:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-01 11:37 Bjørn Mork
2015-07-01 11:37 ` [PATCH 1/2] nnimap.el (nnimap-request-group): don't make nil into a list Bjørn Mork
2015-07-01 11:37 ` [PATCH 2/2] nnimap.el (nnimap-request-group): group could be empty Bjørn Mork
2015-07-01 11:50 ` [PATCH 0/2] two minor fixes for new/empty nnimap group handling Alan Schmitt
2015-07-01 12:23   ` Bjørn Mork
2015-07-01 13:49     ` Alan Schmitt
2015-07-02  2:18 ` Nikolaus Rath
2015-07-06  2:45 ` Eric Abrahamsen
2015-07-06  8:40   ` Bjørn Mork
2015-07-06 15:11     ` Eric Abrahamsen
2015-07-06 15:32 ` Dan Christensen
2015-07-07  2:48   ` Eric Abrahamsen
2015-07-07 23:12     ` Dan Christensen
2015-07-08  4:20       ` Eric Abrahamsen [this message]
2015-07-08 21:45         ` Dan Christensen
2015-07-09  1:53           ` Eric Abrahamsen
2015-07-09  2:52             ` Dan Christensen
2015-07-09 13:47               ` Dan Christensen
2015-07-10  2:41                 ` Eric Abrahamsen
2015-07-10 12:42                   ` Dan Christensen
2015-07-12  4:11               ` Eric Abrahamsen
2015-07-12  4:27                 ` Eric Abrahamsen
2015-07-12 17:01                   ` Dan Christensen
2015-07-13  5:36                     ` Eric Abrahamsen
2015-07-08 12:41       ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zj37nuu3.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).