Subject: bug#41842: 28.0.50; gnus-new-mail-mark is applied to too many groups

From: Eric Abrahamsen <[email-masked]>
Date: Wed, 22 Jul 2020 13:57:03 -0700

Lars Ingebrigtsen <[email-masked]> writes:

> "Basil L. Contovounesios" <[email-masked]> writes:
>
>> This happens because of the way gnus-group-new-mail in gnus-group.el
>> checks whether a given group, such as "nnimap+tcd:INBOX", contains new
>> mail.  It first passes the group name to gnus-group-real-name, which
>> returns "INBOX", and then passes this result to nnmail-new-mail-p, which
>> checks for its presence in nnmail-split-history, whose value is
>> something like:
>>
>>   ((("INBOX" . 0))
>>    (("[Gmail].Sent Mail" . 0))
>>    ...)
>
> Hm, that's a kinda badly misdesigned interface...
>
>> Would it be possible for the variable nnmail-split-history, or the
>> function gnus-group-new-mail, or both, to be changed so they
>> store/manipulate only the full group name "nnimap+tcd:INBOX"?
>
> I think that would be easy to implement for nnimap (it peeks into the
> Gnus structures, so it knows the full Gnus name of the group)...
>
> But looking at the code used in nnmail.el (i.e.,
> nnmail-check-duplication), it doesn't (at that point) know what the Gnus
> group names are; it just gets data from the backends.  (This is when
> nnml splits from, say, pop3 fetching.)
>
> So I don't know how to fix this generally.
>
> Any ideas?

Let's change all group names to be fully prefixed everywhere inside
Gnus. If we must preserve the "primary-select-method-is-unprefixed"
convention, just do it at two places at the edges of the system: when
reading/writing .newsrc.eld, and when displaying the group name in the
*Group* buffer.

The first case is important for backward compatibility, but the second
should be dropped as well: provide one format escape for
prefixed-group-name and another for unprefixed-group-name, and let the
user sort it out.

Look at how much code we could remove!