unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: Karl Fogel <kfogel@red-bean.com>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	Emacs Development <emacs-devel@gnu.org>
Subject: Re: Why does Gnus article-moving act like a fetch of new news?
Date: Mon, 03 May 2021 13:53:17 -0700	[thread overview]
Message-ID: <87tunjsfnm.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87pmyxg81f.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Tue, 13 Apr 2021 14:59:40 -0700")

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

> Karl Fogel <kfogel@red-bean.com> writes:
>
>> On 12 Apr 2021, Eric Abrahamsen wrote:
>>>> On 12 Apr 2021, Eric Abrahamsen wrote:
>>>>> So maybe `gnus-activate-group' would be sufficient? Though it
>>>>> looks
>>>>> like the number-of-articles update is happening at line 10271,
>>>>> anyway.   Karl, would you be willing to patch the function to
>>>>> replace `gnus-group-get-new-news-this-group' with
>>>>> `gnus-activate-group', and run that for a while and see if
>>>>> anything
>>>>> terrible happens?
>>>>
>>>> Yes, I'll do that and set a bit to report back here in two weeks.
>>>> I'm
>>>> happy to be the Gnus test suite for a fortnight :-).
>>>
>>>Hopefully things won't go too wrong :)
>>
>> Well, they go sort-of wrong :-).  Here's what happens:
>>
>> First, this is the patch I'm using:
>>
>>  --- lisp/gnus/gnus-sum.el
>>  +++ lisp/gnus/gnus-sum.el
>>  @@ -10346,8 +10346,8 @@ gnus-summary-move-article
>>         (apply #'gnus-summary-remove-process-mark
>>         articles-to-update-marks))
>>       ;; Re-activate all groups that have been moved to.
>>       (with-current-buffer gnus-group-buffer
>>  -      (let ((gnus-group-marked to-groups))
>>  -	(gnus-group-get-new-news-this-group nil t)))
>>  +      (dolist (group to-groups)
>>  +	(gnus-activate-group group nil t nil t)))
>>          (gnus-kill-buffer copy-buf)
>>       (gnus-summary-position-point)
>>
>> (There's a variant in which that first `nil' argument to
>> `gnus-activate-group' is `t' instead.  I'll discuss both ways below.)
>>
>> * *Without* the patch applied, per-article behavior is correct:
>>
>> If you're in the summary buffer for group A, and you move an article
>> to group B, then if you exit group A's summary buffer and go visit
>> group B's summary, the article is there already, and its
>> read-vs-unread state has been properly preserved.
>>
>> * With the patch as shown above:
>>
>> Immediately after moving an unread article from A to B, when you enter
>> group B's summary buffer and look for the article, it won't be there.
>> However, if you `q'uit out of Gnus and then start Gnus again with `M-x
>> gnus', *then* when you visit B, the article will be in B and marked as
>> unread.
>>
>> Now try the same thing with a marked-as-read article.  Not only will
>> the article not be in group B right away, but even after you quit out
>> of Gnus and then start Gnus again, when you visit group B, the article
>> will be there *but marked as unread*.
>>
>> * With the same patch but with the first `nil' changed to `t':
>>
>> That's the SCAN argument, but changing it to `t' has no effect: it's
>> the same behavior as with the original patch.
>>
>> Now, maybe my patch wasn't what you hand in mind? Comments/suggestions
>> welcome...
>
> Your patch was what I had in mind, and I guess that means the update is
> necessary! I guess I would have expected that
> `gnus-request-accept-article' would take care of all the necessary
> updating of group/article data, but apparently it doesn't. I guess it
> updates the _backend_, but not _Gnus_.

I thought this was worth looking into more closely, and I'm getting
closer to figuring out the problem.

What we really need is to update the "active" number for the receiving
group -- that's Gnus' final authoritative figure for how many articles
are in the group, and if it's not updated then we see Karl's situation
where you enter the receiving group and don't see the moved articles,
until you do a full refresh of the group.

The calls to `gnus-group-get-new-news-this-group' make the world right
only because they end up calling `gnus-get-unread-articles-in-group',
which updates the group's active number (in addition to a bunch of other
stuff).

What I'm trying to figure out now is, what's the minimum amount of code
we can run that does this work, without running a whole bunch of other
unwanted processes. We can't just set the group's active number
directly, because we need to check the cache and the agent, and update
the *Group* buffer, etc., as part of that. So we'll need some
combination of the "larger" functions, invoked properly, but I haven't
figured out yet exactly how that will work.

But anyway, the mystery is clearing.



  parent reply	other threads:[~2021-05-03 20:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-09 21:47 Why does Gnus article-moving act like a fetch of new news? Karl Fogel
2021-04-10  4:11 ` Eric Abrahamsen
2021-04-10  4:58   ` Karl Fogel
2021-04-10  5:29     ` Eric Abrahamsen
2021-04-10  8:29 ` Andreas Schwab
2021-04-10 13:06   ` Stefan Monnier
2021-04-10 22:00     ` Eric Abrahamsen
2021-04-11  6:02       ` Karl Fogel
2021-04-11 16:05 ` Lars Ingebrigtsen
2021-04-12 17:05   ` Eric Abrahamsen
2021-04-12 17:56     ` Karl Fogel
2021-04-12 18:26       ` Eric Abrahamsen
2021-04-13 20:25         ` Karl Fogel
2021-04-13 21:59           ` Eric Abrahamsen
2021-04-14  3:27             ` Karl Fogel
2021-04-25 17:37             ` Lars Ingebrigtsen
2021-05-03 20:52             ` Eric Abrahamsen
2021-05-03 20:53             ` Eric Abrahamsen [this message]
2021-05-05 23:21               ` Karl Fogel

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87tunjsfnm.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=emacs-devel@gnu.org \
    --cc=kfogel@red-bean.com \
    --cc=larsi@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).