Subject: Re: bug#72949: Gnus sometimes reports new messages but not showing them on IMAP server, bug#72949: Gnus sometimes reports new messages but not showing them on IMAP server, bug#72949: Gnus sometimes reports new messages but not showing them on IMAP server

From: James Thomas <[email-masked]>
Date: Mon, 16 Sep 2024 13:56:36 +0530

Dan Christensen wrote:

> On Sep 15, 2024, James Thomas wrote:
>
>> Dan Christensen wrote:
>>
>>>   (max (1+ (- (cdr active) (car active))) 0)
>>
>> Just wanna chime in with what's in (info "(gnus) Required Back End
>> Functions"):
>>
>>   Gnus just discards the total-number, so whether one should take the
>>   bother to generate it properly (if that is a problem) is left as an
>>   exercise to the reader.
>
> That's interesting.  I wonder if it is still correct.
>
> As I mentioned in an earlier message in this bug report, without that
> line of the patch, Gnus gives me an error.  Without that line, Gnus
> would calculate the total number of articles as -1, and this line
> from gnus-start.el would fail to match because of the minus sign:

Wait! I think we've miscommunicated: I'd meant the _other_ patch, the
one in (gnus-summary-goto-article "<[email-masked]>"). I use
that and it's working fine here.

Dan Christensen wrote:

> On Sep 12, 2024, James Thomas wrote:
>
>>> Sorry! I got confused again... Please try the other patch in that bug
>>> report (the one that swaps the car and cdr). I find that it works with
>>> your use case!
>
> Yes, that patch fixes the problem I've had for ages.  But I don't think
> that it's correct.  Here's what is done in nnml.el:
>
> 	  (nnheader-insert "211 %d %d %d %s\n"
> 			   (max (1+ (- (cdr active) (car active))) 0)
> 			   (car active) (cdr active) group)))))))
>
> Notice that the car comes before the cdr, and that you have to add 1
> to the difference between the cdr and the car, since if the active
> range is 2 . 3, then there are 2 active articles, which is one more
> than 3 - 2.  So I suspect that the patch attached below might be
> correct.  Someone who knows more about what the "211" line should
> contain should review this.
>
> My patch also fixes the problem I've had.  With either patch, after
> moving or copying an article to a new group, the new group has (active 1
> . 1) as expected, with no unexist entry.
>
> But the two patches would behave differently when active was already set.
>
> Dan

The total shouldn't need any change for these reasons below.

James Thomas wrote:

> Just wanna chime in with what's in (info "(gnus) Required Back End
> Functions"):
>
>   Gnus just discards the total-number, so whether one should take the
>   bother to generate it properly (if that is a problem) is left as an
>   exercise to the reader.
>
> --

>>>> I see that many other parts of Gnus do a correct calculation of the
>>>> total number of articles
>>>
>>> Wrt this function?
>>
>> Yes, for example, the code from nnml-request-group that I posted
>> earlier in the thread, and other places that have "211".
>
> No, I mean something that _uses_ that value? The only function I can
> find is 'gnus-browse-foreign-server' which doesn't.

Could you try again with that patch and a clean newsrc?

Regards,
James