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: Sun, 06 Jun 2021 10:51:56 -0700

Lars Ingebrigtsen <[email-masked]> writes:

> Alex Bochannek <[email-masked]> writes:
>
>> What I am trying to achieve is:
>>
>> - Allow limiting and scoring by newsgroup name in an nnvirtual group
>> - Still use caching and agent mode for the nnvirtual and constituent
>>   groups
>>
>> For the second part I simply set `gnus-agent-cache' to non-nil and add
>> the constituent groups to the agent. I didn't see a need to add the
>> virtual group to the agent, because as long as all constituent groups
>> are, I still get caching and agent mode.
>
> Hm...  Am I misreading the patch, then?  This bit:
>
>       ((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)
> ..
>        (gnus-agent-retrieve-headers articles group fetch-old))
>
> seems to disable the agent then gnus-nov-is-evil is set?

The scenario in which this change applies is when the agent is plugged
and when the group is in an agent category. In the case where the
nnvirtual is not in the agent, but the constituent groups are, I want to
not use NOV so I can get the extra headers.

I think your concern is that when `gnus-nov-is-evil' is set globally, it
will effectively disable the agent for everything? Maybe this logic
should reside in `gnus-agent-retrieve-headers' instead?

To address the unbound nov-is-evil for nnvirtual issue, this would work.
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 01053797b3..3fe69ec471 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -522,12 +522,18 @@ gnus-close-group
 (defun gnus-retrieve-headers (articles group &optional fetch-old)
   "Request headers for ARTICLES in GROUP.
 If FETCH-OLD, retrieve all headers (or some subset thereof) in the group."
-  (let ((gnus-command-method (gnus-find-method-for-group group)))
+  (let* ((gnus-command-method (gnus-find-method-for-group group))
+         (gnus-method-nov-is-evil (intern
+		                   (format "%s-nov-is-evil"
+                                           (car gnus-command-method)))))
     (cond
      ((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 (and (boundp gnus-method-nov-is-evil)
+                     (symbol-value gnus-method-nov-is-evil))))
       (gnus-agent-retrieve-headers articles group fetch-old))
      (t
       (funcall (gnus-get-function gnus-command-method 'retrieve-headers)
>> P.S.: Is there a better place to discuss this? gmane.emacs.gnus.general?
>
> Sure, but it's very low volume these days, so there's probably not that
> many more people reading that group than the bug list.  :-/

That's unfortunate, I'll stick to the bugs list then.

-- 
Alex.