Subject: Re: M-g doesn't work with gnus-no-server
From: Daiki Ueno <[email-masked]>
To: Lars Ingebrigtsen <[email-masked]>
Cc: Andreas Schwab <[email-masked]>, [email-masked]
Date: Wed, 10 Feb 2016 13:20:58 +0900
Newsgroups: gmane.emacs.gnus.general
List-Id: <ding.gnus.org>

Lars Ingebrigtsen <[email-masked]> writes:

>> * lisp/gnus/gnus-group.el: Don't call `gnus-request-group-scan' if
>> server is not opened.
>
> Well, we want `M-g' to open the server if it isn't already...  so
> perhaps we should just call `gnus-activate-group'?

I am not really sure if I get your suggestion, but how about this?

Regards,
-- 
Daiki Ueno
From d84b39a671f3c36634d92897205f3d812a64e9ba Mon Sep 17 00:00:00 2001
From: Daiki Ueno <[email-masked]>
Date: Tue, 9 Feb 2016 17:37:59 +0900
Subject: [PATCH] gnus: Make M-g work with gnus-no-server

* lisp/gnus/gnus-group.el: Divert to call `gnus-activate-group' with the
SCAN argument set, if request-group-scan is not defined for the backend.
Ensure that the server is open when calling `gnus-request-group-scan'.
---
 lisp/gnus/gnus-group.el | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 1cd16a4..5554569 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -4109,9 +4109,14 @@ gnus-group-get-new-news-this-group
       (gnus-group-remove-mark group)
       ;; Bypass any previous denials from the server.
       (gnus-remove-denial (setq method (gnus-find-method-for-group group)))
-      (if (or (and (not dont-scan)
-		   (gnus-request-group-scan group (gnus-get-info group)))
-	      (gnus-activate-group group (if dont-scan nil 'scan) nil method))
+      (if (if (and (not dont-scan)
+		   ;; Prefer request-group-scan if the backend supports it.
+		   (gnus-check-backend-function 'request-group-scan group))
+	      (progn
+		;; Ensure that the server is already open.
+		(gnus-activate-group group nil nil method)
+		(gnus-request-group-scan group (gnus-get-info group)))
+	    (gnus-activate-group group (if dont-scan nil 'scan) nil method))
 	  (let ((info (gnus-get-info group))
 		(active (gnus-active group)))
 	    (when info
-- 
2.5.0