Subject: bug#48801: 28.0.50; [PATCH] Feature suggestion gnus-retrieve-headers check for nov-is-evil when agent is enabled

From: Alex Bochannek <[email-masked]>
Date: Wed, 02 Jun 2021 14:13:21 -0700

Hello!

I am trying to solve the following problem: Using nnvirtual groups that
are made up of several nntp newsgroups I would like to limit by
`Newsgroups' when in the nnvirtual. From reading the code, it appears
that this means I cannot use NOV because then the extra headers list
won't be generated. I can set `nov-is-evil' and this works. Except when
I am also using agent mode, in which case it will always use the NOV.

The below patch is a work in progress and doesn't entirely work yet, but
I wanted to share it early before I spend more time on it.

The following questions have come up for me:

1) Is there a different way to solve this problem? Specifically, is
there a better way to limit by newsgroup when in an nnvirtual group?
2) Is it possible to set `nntp-nov-is-evil' as a group parameter? It
looks like header retrieval may be too early for this and I may need to
use a hook?
3) How would this approach interact with the local cache? I have not
looked at this path yet.

Thanks!
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 01053797b3..d2d7fd55ae 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -527,7 +527,11 @@ gnus-retrieve-headers
      ((and gnus-use-cache (numberp (car articles)))
       (gnus-cache-retrieve-headers articles group fetch-old))
      ((and gnus-agent (gnus-online gnus-command-method)
-	   (gnus-agent-method-p gnus-command-method))
+	   (gnus-agent-method-p gnus-command-method)
+	   (not gnus-nov-is-evil)
+	   (not (symbol-value
+		 (intern
+		  (format "%s-nov-is-evil" (car gnus-command-method))))))
       (gnus-agent-retrieve-headers articles group fetch-old))
      (t
       (funcall (gnus-get-function gnus-command-method 'retrieve-headers)
-- 
Alex.