GNU bug report logs - #72949
[PATCH] Wrong unread count in the Group buffer in nnimap

Previous Next

Package: emacs;

Reported by: James Thomas <jimjoe <at> gmx.net>

Date: Mon, 2 Sep 2024 06:01:02 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 31.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #65 received at 72949 <at> debbugs.gnu.org (full text, mbox):

From: James Thomas <jimjoe <at> gmx.net>
To: Dan Christensen <jdc <at> uwo.ca>
Cc: "72949 <at> debbugs.gnu.org" <72949 <at> debbugs.gnu.org>
Subject: Re: bug#72949: Gnus sometimes reports new messages but not showing
 them on IMAP server
Date: Tue, 17 Sep 2024 09:36:49 +0530
Dan Christensen wrote:

> On Sep 16, 2024, James Thomas <jimjoe <at> gmx.net> wrote:
>
>> Wait! I think we've miscommunicated: I'd meant the _other_ patch, the
>> one in (gnus-summary-goto-article "<86zfoqpobd.fsf <at> gmx.net>"). I use
>> that and it's working fine here.
>
> I believe you are talking about the patch to nnimap-request-group that
> swaps the car and the cdr:
>
>  	(insert (format "211 %d %d %d %S\n"
>  			(- (cdr active) (car active))
> -			(car active)
>  			(cdr active)
> +			(car active)
>  			group))
>
> After that patch, the relevant part of nnimap-request-group would look
> like:
>
> 	(setq active (or active '(0 . 1)))
> 	(erase-buffer)
> 	(insert (format "211 %d %d %d %S\n"
> 			(- (cdr active) (car active))
> 			(cdr active)
> 			(car active)
> 			group))
>
> This code has two bugs that (mostly) cancel each other out.  First, when
> the group is empty, it represents that with the active range (0 . 1).
> But that active range represents a group with two articles, numbered 0
> and 1.  If you look throughout Gnus, the empty group is always
> represented by the range (1 . 0).
>
> Second, this code has the car and the cdr in the wrong order.
> Everywhere else in Gnus that creates a 211 line from an active
> range puts the car before the cdr.  In the case of an empty group,
> these two bugs cancel.  But if active already had a non-nil value,
> then the car and the cdr would be wrong.  And even if the active
> range is always nil at this point, I don't approve of code that
> has two bugs that cancel.
>
> After my proposed patch (attached again), the code looks like
>
> 	(setq active (or active '(1 . 0)))
> 	(erase-buffer)
> 	(insert (format "211 %d %d %d %S\n"
> 			(max (1+ (- (cdr active) (car active))) 0)
> 			(car active)
> 			(cdr active)
> 			group))
>
> Now the active range is correctly set to (1 . 0) for an empty group.
> This alone doesn't work, as the expression (- (cdr active) (car active))
> in the current code would then give a negative value for the number of
> articles, which breaks at least one other place in Gnus.  So we use
> the calculation that nnml-request-group uses to get the correct number
> of articles in the range (by adding 1), and also force negative values
> to 0, just in case active contains some bogus data.
>
> I think this is the correct way to proceed, in line with how all
> the other parts of Gnus create the 211 line.

Thank you for the patient explanation! (I blame the confusion on the on
and off attention I gave to this). Your patch LGTM.

Regards,
James




This bug report was last modified 274 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.