Gnus development mailing list
 help / color / mirror / Atom feed
From: Matt Lundin <mdl@imapmail.org>
To: ding@gnus.org
Subject: Re: nnir-run-gmane search broken
Date: Fri, 10 Dec 2010 10:01:05 -0500	[thread overview]
Message-ID: <878vzx1xla.fsf@fastmail.fm> (raw)
In-Reply-To: <874oaof4kz.fsf@fastmail.fm>

Matt Lundin <mdl@imapmail.org> writes:

> Matt Lundin <mdl@imapmail.org> writes:
>
>> Andrew Cohen <cohen@andy.bu.edu> writes:
>>> 3. A compromise: go back to the crappy test of gmane in the server
>>>    name. Most of the time this will DTRT except when a user has the
>>>    string "gmane" in some server that isn't really news.gmane.org (or
>>>    snews.gmane.org). This has the defects of 2, but only in rare
>>>    cases.
>>
>> Could we simply check whether the nntp-address is defined? If so, then
>> the nntp-address must match "gmane.org$"; if not, then the server name
>> should match "gmane.org$". These are effectively the same test, since in
>> the shorter method of defining the server the name *is* the address. In
>> other words, if one uses a "nickname" (supergmane, gmaneman, etc.) for
>> some other nntp server, then one must define an nntp-address;
>> conversely, if one does not define an nntp-address, then the name of the
>> server has to be the full address. In either case, you are testing
>> against the address instead of some arbitrary name and thus can enforce
>> the stricter match ("gmane.org$").
>>
>
> I suppose I should have written "gmane\.org$" (or "gmane\\.org$" for the
> emacs-lisp). :)
>

Here's a brief patch that implements my rather verbose proposal above.

Best,
Matt

diff --git a/lisp/nnir.el b/lisp/nnir.el
index 726b015..820e565 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -1394,7 +1394,10 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
 ;; gmane interface
 (defun nnir-run-gmane (query srv &optional groups)
   "Run a search against a gmane back-end server."
-  (if (gnus-string-match-p  "gmane" srv)
+  (if (gnus-string-match-p
+       "gmane\\.org$"
+       (or (cadr (assoc 'nntp-address (cddr (gnus-server-to-method srv))))
+	   srv))
       (let* ((case-fold-search t)
 	     (qstring (cdr (assq 'query query)))
 	     (server (cadr (gnus-server-to-method srv)))




      reply	other threads:[~2010-12-10 15:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-07  4:08 Matt Lundin
2010-12-07 10:09 ` Robert Pluim
2010-12-07 13:20   ` Andrew Cohen
2010-12-08 19:17     ` Matt Lundin
2010-12-08 19:27       ` Matt Lundin
2010-12-10 15:01         ` Matt Lundin [this message]

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=878vzx1xla.fsf@fastmail.fm \
    --to=mdl@imapmail.org \
    --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).