From: Dan Christensen <jdc@uwo.ca>
To: James Thomas <jimjoe@gmx.net>
Cc: "72949@debbugs.gnu.org" <72949@debbugs.gnu.org>,
"ding@gnus.org" <ding@gnus.org>
Subject: Re: bug#72949: Gnus sometimes reports new messages but not showing them on IMAP server
Date: Mon, 16 Sep 2024 12:42:38 +0000 [thread overview]
Message-ID: <87cyl3u5vo.fsf_-_@uwo.ca> (raw)
In-Reply-To: <86plp4ovgj.fsf@gmx.net> (James Thomas's message of "Mon, 16 Sep 2024 13:56:36 +0530")
[-- Attachment #1: Type: text/plain, Size: 2338 bytes --]
On Sep 16, 2024, James Thomas <jimjoe@gmx.net> wrote:
> Wait! I think we've miscommunicated: I'd meant the _other_ patch, the
> one in (gnus-summary-goto-article "<86zfoqpobd.fsf@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.
Dan
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnimap.patch --]
[-- Type: text/x-diff; name="nnimap.patch", Size: 594 bytes --]
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 17a55f98..cdd9f01f 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -918,10 +918,10 @@ nnimap-request-group
(nnimap-finish-retrieve-group-infos server info sequences
t)
(setq active (nth 2 (assoc group nnimap-current-infos)))))
- (setq active (or active '(0 . 1)))
+ (setq active (or active '(1 . 0)))
(erase-buffer)
(insert (format "211 %d %d %d %S\n"
- (- (cdr active) (car active))
+ (max (1+ (- (cdr active) (car active))) 0)
(car active)
(cdr active)
group))
next prev parent reply other threads:[~2024-09-16 12:42 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 0:57 Xiyue Deng
2024-04-17 0:03 ` Greg Troxel
2024-04-17 6:47 ` Xiyue Deng
2024-04-17 19:51 ` Dan Christensen
2024-04-18 12:13 ` Greg Troxel
2024-04-19 22:55 ` Dan Christensen
2024-04-21 12:08 ` Arash Esbati
2024-04-21 12:43 ` Dan Christensen
2024-04-21 13:14 ` Andreas Schwab
2024-04-21 16:18 ` Eric Abrahamsen
2024-04-21 18:16 ` Arash Esbati
2024-04-22 0:00 ` Greg Troxel
2024-04-22 2:35 ` Eric Abrahamsen
2024-04-27 19:46 ` Xiyue Deng
2024-05-02 5:47 ` Xiyue Deng
2024-05-02 15:08 ` Eric Abrahamsen
2024-05-02 17:24 ` Xiyue Deng
2024-05-02 17:41 ` Dan Christensen
2024-05-02 18:41 ` Xiyue Deng
2024-05-05 20:18 ` Xiyue Deng
2024-05-05 21:01 ` Dan Christensen
2024-05-05 22:10 ` Xiyue Deng
2024-05-08 18:36 ` Xiyue Deng
2024-05-08 18:41 ` Xiyue Deng
2024-05-09 23:11 ` Andrew Cohen
2024-05-10 7:45 ` Xiyue Deng
2024-05-10 8:16 ` Andrew Cohen
2024-05-10 8:26 ` Xiyue Deng
2024-05-10 9:13 ` Andreas Schwab
2024-05-10 0:43 ` Greg Troxel
2024-05-10 1:20 ` Xiyue Deng
2024-05-10 12:24 ` Greg Troxel
2024-05-10 20:06 ` Xiyue Deng
2024-05-11 19:08 ` Greg Troxel
2024-05-11 22:33 ` Eric Abrahamsen
2024-05-12 11:14 ` Gnus sometimes fails to see a message that is actually in IMAP Greg Troxel
2024-05-13 14:39 ` Eric Abrahamsen
2024-05-24 15:58 ` Eric Abrahamsen
2024-05-24 17:29 ` Eric Abrahamsen
2024-04-24 15:23 ` Gnus sometimes reports new messages but not showing them on IMAP server James Thomas
2024-04-25 2:59 ` Eric Abrahamsen
[not found] ` <868qwar3yn.fsf@gmx.net>
2024-09-11 1:25 ` James Thomas
[not found] ` <87r09q1i0s.fsf@uwo.ca>
[not found] ` <868qvx1xst.fsf@gmx.net>
2024-09-12 7:25 ` bug#72949: " James Thomas
2024-09-14 14:20 ` Dan Christensen
2024-09-14 16:28 ` Dan Christensen
2024-09-14 19:02 ` Adam Sjøgren
[not found] ` <87frq2xh4c.fsf@uwo.ca>
[not found] ` <86h6ah2q47.fsf@gmx.net>
2024-09-15 12:49 ` Dan Christensen
2024-09-15 21:55 ` James Thomas
2024-09-15 23:07 ` Dan Christensen
2024-09-16 0:51 ` James Thomas
[not found] ` <86plp4ovgj.fsf@gmx.net>
2024-09-16 12:42 ` Dan Christensen [this message]
[not found] ` <86zfo69b52.fsf@gmx.net>
[not found] ` <86setx3o07.fsf@gmx.net>
2024-09-17 23:03 ` Dan Christensen
2024-09-18 2:27 ` James Thomas
2024-09-24 12:50 ` Dan Christensen
2024-10-01 20:50 ` Dan Christensen
2024-10-01 21:30 ` Stefan Kangas
2024-10-01 22:25 ` Dan Christensen
2024-10-02 16:55 ` Robert Pluim
2024-10-11 13:36 ` Robert Pluim
2024-10-11 13:45 ` Dan Christensen
2024-10-11 13:51 ` Robert Pluim
2024-10-11 15:39 ` Eli Zaretskii
2024-10-15 8:28 ` Robert Pluim
[not found] ` <87jzfexh4k.fsf@uwo.ca>
[not found] ` <878qvu58fc.fsf@igel.home>
[not found] ` <87ldzuvt97.fsf@uwo.ca>
[not found] ` <874j6h6g09.fsf@igel.home>
2024-09-14 23:17 ` Dan Christensen
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=87cyl3u5vo.fsf_-_@uwo.ca \
--to=jdc@uwo.ca \
--cc=72949@debbugs.gnu.org \
--cc=ding@gnus.org \
--cc=jimjoe@gmx.net \
/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).