From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/74894 Path: news.gmane.org!not-for-mail From: Matt Lundin Newsgroups: gmane.emacs.gnus.general Subject: Re: nnir-run-gmane search broken Date: Fri, 10 Dec 2010 10:01:05 -0500 Message-ID: <878vzx1xla.fsf@fastmail.fm> References: <87vd36p6mo.fsf@fastmail.fm> <87fwu9k9ck.fsf@andy.bu.edu> <87d3pcf50g.fsf@fastmail.fm> <874oaof4kz.fsf@fastmail.fm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1291993341 5921 80.91.229.12 (10 Dec 2010 15:02:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Dec 2010 15:02:21 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M23250@lists.math.uh.edu Fri Dec 10 16:02:17 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PR4UC-0000y9-N7 for ding-account@gmane.org; Fri, 10 Dec 2010 16:02:17 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PR4TJ-0005zK-Fn; Fri, 10 Dec 2010 09:01:21 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PR4TH-0005z9-WC for ding@lists.math.uh.edu; Fri, 10 Dec 2010 09:01:20 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PR4TG-0001eN-Gn for ding@lists.math.uh.edu; Fri, 10 Dec 2010 09:01:19 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1PR4TF-0005il-00 for ; Fri, 10 Dec 2010 16:01:17 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PR4TF-0000PK-Je for ding@gnus.org; Fri, 10 Dec 2010 16:01:17 +0100 Original-Received: from 67-197-63-212.rh2.dyn.cm.comporium.net ([67.197.63.212]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Dec 2010 16:01:17 +0100 Original-Received: from mdl by 67-197-63-212.rh2.dyn.cm.comporium.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 10 Dec 2010 16:01:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 48 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 67-197-63-212.rh2.dyn.cm.comporium.net User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:IGWvnMCe7OUZHPteLlAo19nWxro= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:74894 Archived-At: Matt Lundin writes: > Matt Lundin writes: > >> Andrew Cohen 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)))