From: asjo@koldfront.dk (Adam Sjøgren)
To: ding@gnus.org
Subject: [PATCH] Avoid opening secondary select methods as foreign servers
Date: Wed, 07 Jul 2010 01:57:11 +0200 [thread overview]
Message-ID: <8739vwupt4.fsf_-_@topper.koldfront.dk> (raw)
In-Reply-To: <87bpakfhtg.fsf@topper.koldfront.dk>
This is probably the wrong way to fix the problem - which is that
Gnus opens servers defined in secondary-select-methods twice, once
with all the configuration given and once as a foreign server with
none of the configuration given.
The easy way to see the symptom is to go to the *Server* buffer where
servers will be listed twice, or to check the value of the
gnus-opened-servers variable, which holds the same server twice.
This patch changes gnus-secondary-select-method-p to only look at
the first two elements in the list (nntp and "news.server.org"),
because the incoming argument never has the entire list.
gnus-check-server is then changed to call gnus-secondary-select-method-p
and if the server in question is in secondary-select-methods, the
configuration from there is used.
---
lisp/gnus-int.el | 3 +++
lisp/gnus.el | 6 +++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el
index a079591..94fb6c7 100644
--- a/lisp/gnus-int.el
+++ b/lisp/gnus-int.el
@@ -169,6 +169,9 @@ If it is down, start it up (again)."
;; Transform virtual server names into select methods.
(when (stringp method)
(setq method (gnus-server-to-method method)))
+ ;; Get configuration if the server is a secondary-select-method.
+ (when (gnus-secondary-method-p method)
+ (setq method (car (gnus-secondary-method-p method))))
(if (gnus-server-opened method)
;; The stream is already opened.
t
diff --git a/lisp/gnus.el b/lisp/gnus.el
index 281b9ab..c3a442a 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -3830,9 +3830,9 @@ You should probably use `gnus-find-method-for-group' instead."
(let ((methods gnus-secondary-select-methods)
(gmethod (inline (gnus-server-get-method nil method))))
(while (and methods
- (not (gnus-method-equal
- (inline (gnus-server-get-method nil (car methods)))
- gmethod)))
+ (not (and
+ (equal (caar methods) (car gmethod))
+ (equal (cadar methods) (cadr gmethod)))))
(setq methods (cdr methods)))
methods))
--
1.7.1
I am sure there are better solutions.
It is quite confusing to me how sometimes servers are referred to as
"nntp+news.server.org", sometimes as (nttp "news.server.org") and
sometimes as (nntp "news.server.org" (var 1) (var 2) ...).
Finding the correct place to fix the translation/comparison of these is
far from obvious to me.
Best regards,
Adam
--
"My internal clock is on Tokyo time." Adam Sjøgren
asjo@koldfront.dk
next prev parent reply other threads:[~2010-07-06 23:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-06 20:51 Setting gnus-check-new-newsgroups to nil --> gnus-secondary-select-methods ignored Adam Sjøgren
2010-07-06 20:58 ` Adam Sjøgren
2010-07-06 23:57 ` Adam Sjøgren [this message]
2010-07-17 20:13 ` Avoid opening secondary select methods as foreign servers Adam Sjøgren
2010-08-03 19:10 ` Ted Zlatanov
2010-08-08 13:59 ` Adam Sjøgren
2010-08-08 14:14 ` Adam Sjøgren
2010-08-09 14:12 ` Ted Zlatanov
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8739vwupt4.fsf_-_@topper.koldfront.dk \
--to=asjo@koldfront.dk \
--cc=ding@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.
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 NNTP newsgroup(s).