unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61539: 29.0.60; When nnselect-always-regenerate, group info gets out-of-date
@ 2023-02-15 19:47 Sean Whitton
  2023-02-18 20:20 ` Sean Whitton
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Whitton @ 2023-02-15 19:47 UTC (permalink / raw)
  To: 61539; +Cc: cohen

X-debbugs-cc: cohen@andy.bu.edu

1. Same setup described in #56592, but additionally set
   nnselect-always-regenerate to t for the groups.
2. Enter group.  Mark an unread article as read.

   (length gnus-newsgroup-selection) => 935
   (car (last (gnus-info-read (gnus-get-info gnus-newsgroup-name))))
       => (930 . 935)

3. Exit group.  Enter group again.

   (length gnus-newsgroup-selection) => 934
   (car (last (gnus-info-read (gnus-get-info gnus-newsgroup-name))))
       => (930 . 935)

4. Attempt to exit group again.  Then, while binding select-reads at the
   beginning of nnselect-push-info, nnselect-categorize signals
   args-out-of-range, because one of the inline functions it calls
   attempts to read the 935th element of gnus-newsgroup-selection.

I believe that the nnselect-always-regenerate branch of
nnselect-get-artlist needs to update the group info, because the
following hack seems to avoid the problem.

-- >8 --
diff --git a/lisp/gnus/nnselect.el b/lisp/gnus/nnselect.el
index 87cb1275313..fdb4956b8e6 100644
--- a/lisp/gnus/nnselect.el
+++ b/lisp/gnus/nnselect.el
@@ -303,7 +303,10 @@ nnselect-get-artlist
        (cond
         (override (funcall override ,group))
         ((gnus-group-get-parameter ,group 'nnselect-always-regenerate)
-         (nnselect-generate-artlist ,group))
+         (let* ((artlist (nnselect-generate-artlist ,group))
+                (gnus-newsgroup-selection artlist))
+           (nnselect-request-update-info ,group (gnus-get-info ,group))
+           artlist))
         (t
 	 (nnselect-uncompress-artlist
           (gnus-group-get-parameter ,group 'nnselect-artlist t)))))))

-- 
Sean Whitton





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#61539: 29.0.60; When nnselect-always-regenerate, group info gets out-of-date
  2023-02-15 19:47 bug#61539: 29.0.60; When nnselect-always-regenerate, group info gets out-of-date Sean Whitton
@ 2023-02-18 20:20 ` Sean Whitton
  2023-03-11 21:18   ` Sean Whitton
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Whitton @ 2023-02-18 20:20 UTC (permalink / raw)
  To: 61539; +Cc: cohen

control: tag -1 + patch

Hello,

On Wed 15 Feb 2023 at 12:47PM -07, Sean Whitton wrote:

> 1. Same setup described in #56592, but additionally set
>    nnselect-always-regenerate to t for the groups.
> 2. Enter group.  Mark an unread article as read.
>
>    (length gnus-newsgroup-selection) => 935
>    (car (last (gnus-info-read (gnus-get-info gnus-newsgroup-name))))
>        => (930 . 935)
>
> 3. Exit group.  Enter group again.
>
>    (length gnus-newsgroup-selection) => 934
>    (car (last (gnus-info-read (gnus-get-info gnus-newsgroup-name))))
>        => (930 . 935)
>
> 4. Attempt to exit group again.  Then, while binding select-reads at the
>    beginning of nnselect-push-info, nnselect-categorize signals
>    args-out-of-range, because one of the inline functions it calls
>    attempts to read the 935th element of gnus-newsgroup-selection.

Andrew Cohen sent me the following fix.  I've asked him whether he
thinks this is safe enough for emacs-29.

-- >8 --
From: Andrew Cohen <cohen@bu.edu>

diff --git a/lisp/gnus/nnselect.el b/lisp/gnus/nnselect.el
index 87cb1275313..516433aba93 100644
--- a/lisp/gnus/nnselect.el
+++ b/lisp/gnus/nnselect.el
@@ -350,9 +350,9 @@ nnselect-request-group
     ;; the result.
     (unless nnselect-artlist
       (nnselect-store-artlist group
-       (setq nnselect-artlist (nnselect-generate-artlist group)))
+       (setq nnselect-artlist (nnselect-generate-artlist group))))
       (nnselect-request-update-info
-       group (or info (gnus-get-info group))))
+       group (or info (gnus-get-info group)))
     (if (zerop (setq length (nnselect-artlist-length nnselect-artlist)))
 	(progn
 	  (nnheader-report 'nnselect "Selection produced empty results.")
@@ -880,11 +880,13 @@ nnselect-search-thread
 
 
 
-(defun nnselect-push-info (group)
+(defun nnselect-push-info (_group)
   "Copy mark-lists from GROUP to the originating groups."
   (let ((select-unreads (numbers-by-group gnus-newsgroup-unreads))
 	(select-reads (numbers-by-group
-		       (gnus-info-read (gnus-get-info group)) 'range))
+                       (gnus-sorted-difference gnus-newsgroup-articles
+					       gnus-newsgroup-unreads)
+                       'range))
 	(select-unseen (numbers-by-group gnus-newsgroup-unseen))
 	(gnus-newsgroup-active nil) mark-list)
     ;; collect the set of marked article lists categorized by

-- 
Sean Whitton





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#61539: 29.0.60; When nnselect-always-regenerate, group info gets out-of-date
  2023-02-18 20:20 ` Sean Whitton
@ 2023-03-11 21:18   ` Sean Whitton
  2023-09-04 19:46     ` stefankangas
  0 siblings, 1 reply; 6+ messages in thread
From: Sean Whitton @ 2023-03-11 21:18 UTC (permalink / raw)
  To: 61539; +Cc: cohen

Hello,

On Sat 18 Feb 2023 at 01:20PM -07, Sean Whitton wrote:

> Andrew Cohen sent me the following fix.  I've asked him whether he
> thinks this is safe enough for emacs-29.

Just to update this bug, I've been in touch with Andrew recently and he
has sent some improved versions of the fix (many thanks again), but
there are some residual bugs he's still working out before I can do some
final testing.

The final patch will very likely be too large for Emacs 29.

-- 
Sean Whitton





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#61539: 29.0.60; When nnselect-always-regenerate, group info gets out-of-date
  2023-03-11 21:18   ` Sean Whitton
@ 2023-09-04 19:46     ` stefankangas
  2023-09-04 23:21       ` Andrew Cohen
  0 siblings, 1 reply; 6+ messages in thread
From: stefankangas @ 2023-09-04 19:46 UTC (permalink / raw)
  To: Sean Whitton; +Cc: cohen, 61539

Sean Whitton <spwhitton@arizona.edu> writes:

> Just to update this bug, I've been in touch with Andrew recently and he
> has sent some improved versions of the fix (many thanks again), but
> there are some residual bugs he's still working out before I can do some
> final testing.
>
> The final patch will very likely be too large for Emacs 29.

Did you make any progress here?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#61539: 29.0.60; When nnselect-always-regenerate, group info gets out-of-date
  2023-09-04 19:46     ` stefankangas
@ 2023-09-04 23:21       ` Andrew Cohen
  2023-09-05  6:16         ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Cohen @ 2023-09-04 23:21 UTC (permalink / raw)
  To: stefankangas; +Cc: cohen, Sean Whitton, 61539

>>>>> "s" == stefankangas  <stefankangas@gmail.com> writes:

    s> Sean Whitton <spwhitton@arizona.edu> writes:
    >> Just to update this bug, I've been in touch with Andrew recently
    >> and he has sent some improved versions of the fix (many thanks
    >> again), but there are some residual bugs he's still working out
    >> before I can do some final testing.
    >> 
    >> The final patch will very likely be too large for Emacs 29.

    s> Did you make any progress here?

Just forgot to close the bug. Its all pushed to master quite some time
ago.

Thanks,
Andy

-- 
Andrew Cohen





^ permalink raw reply	[flat|nested] 6+ messages in thread

* bug#61539: 29.0.60; When nnselect-always-regenerate, group info gets out-of-date
  2023-09-04 23:21       ` Andrew Cohen
@ 2023-09-05  6:16         ` Stefan Kangas
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Kangas @ 2023-09-05  6:16 UTC (permalink / raw)
  To: Andrew Cohen; +Cc: Sean Whitton, 61539-done

Andrew Cohen <cohen@bu.edu> writes:

> Just forgot to close the bug. Its all pushed to master quite some time
> ago.

OK, thanks.  Closing.





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-05  6:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-15 19:47 bug#61539: 29.0.60; When nnselect-always-regenerate, group info gets out-of-date Sean Whitton
2023-02-18 20:20 ` Sean Whitton
2023-03-11 21:18   ` Sean Whitton
2023-09-04 19:46     ` stefankangas
2023-09-04 23:21       ` Andrew Cohen
2023-09-05  6:16         ` Stefan Kangas

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).