2006-04-11 Sascha Wilde <wilde@sha-bang.de> (tiny patch)
[gnus] / contrib / nnir.el
index c976cf7..0c0f2b4 100644 (file)
@@ -18,8 +18,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
 
 ;;; Setup Code:
 
-(defconst nnir-version "$Id: nnir.el,v 7.1 2004/01/04 21:50:49 larsi Exp $"
-  "Version of NNIR.")
-
 (require 'cl)
 (require 'nnoo)
 (require 'gnus-group)
@@ -379,7 +376,8 @@ Add an entry here when adding a new search engine.")
 ;;; User Customizable Variables:
 
 (defgroup nnir nil
-  "Search nnmh and nnml groups in Gnus with Glimpse, freeWAIS-sf, or EWS.")
+  "Search nnmh and nnml groups in Gnus with Glimpse, freeWAIS-sf, or EWS."
+  :group 'gnus)
 
 ;; Mail backend.
 
@@ -534,18 +532,31 @@ that it is for swish++, not Glimpse."
   :type '(regexp)
   :group 'nnir)
 
-;; Swish-E.  Next three variables Copyright (C) 2000 Christoph Conrad
-;; <christoph.conrad@gmx.de>.
+;; Swish-E.
 ;; URL: http://sunsite.berkeley.edu/SWISH-E/
 ;; New version: http://www.boe.es/swish-e
+;; Variables `nnir-swish-e-index-file', `nnir-swish-e-program' and
+;; `nnir-swish-e-additional-switches'
+;; Copyright (C) 2000 Christoph Conrad <christoph.conrad@gmx.de>.
 
+(make-obsolete-variable 'nnir-swish-e-index-file
+                       'nnir-swish-e-index-files)
 (defcustom nnir-swish-e-index-file
   (expand-file-name "~/Mail/index.swish-e")
   "*Index file for swish-e.
-This could be a server parameter."
+This could be a server parameter.
+It is never consulted once `nnir-swish-e-index-files', which should be
+used instead, has been customized."
   :type '(file)
   :group 'nnir)
 
+(defcustom nnir-swish-e-index-files
+  (list nnir-swish-e-index-file)
+  "*List of index files for swish-e.
+This could be a server parameter."
+  :type '(repeat (file))
+  :group 'nnir)
+
 (defcustom nnir-swish-e-program "swish-e"
   "*Name of swish-e search executable.
 This cannot be a server parameter."
@@ -692,7 +703,17 @@ that it is for Namazu, not Glimpse."
     'gnus-group-make-nnir-group))
 (add-hook 'gnus-group-mode-hook 'nnir-group-mode-hook)
 
-
+(defmacro nnir-group-server (group)
+  "Return the server for a foreign newsgroup GROUP.
+The returned format is as `gnus-server-to-method' needs it.  See
+`gnus-group-real-prefix' and `gnus-group-real-name'."
+  `(let ((gname ,group))
+     (if (string-match "^\\([^:]+\\):" gname)
+        (setq gname (match-string 1 gname))
+       nil)
+     (if (string-match "^\\([^+]+\\)\\+\\(.+\\)$" gname)
+        (format "%s:%s" (match-string 1 gname) (match-string 2 gname))
+       (concat gname ":"))))
 
 ;; Summary mode commands.
 
@@ -1126,7 +1147,7 @@ Windows NT 4.0."
               dirnam (file-name-directory (match-string 2)))
 
         ;; don't match directories
-        (when (string-match "^[0-9]+$" artno)
+        (when (string-match "^[0-9]+\\(\\.gz\\)?$" artno)
           (when (not (null dirnam))
 
            ;; maybe limit results to matching groups.
@@ -1188,18 +1209,18 @@ Tested with swish-e-2.0.1 on Windows NT 4.0."
       (erase-buffer)
 
       (message "Doing swish-e query %s..." query)
-      (let* ((index-file
+      (let* ((index-files
              (or (nnir-read-server-parm
-                  'nnir-swish-e-index-file server)
-                 (error "Missing parameter `nnir-swish-e-index-file'")))
+                  'nnir-swish-e-index-files server)
+                 (error "Missing parameter `nnir-swish-e-index-files'")))
             (additional-switches
              (nnir-read-server-parm
-              'nnir-swish++-additional-switches server))
+              'nnir-swish-e-additional-switches server))
             (cp-list `(,nnir-swish-e-program
                        nil             ; input from /dev/null
                        t               ; output
                        nil             ; don't redisplay
-                       "-f" ,index-file
+                       "-f" ,@index-files
                        ,@additional-switches
                        "-w"
                        ,qstring        ; the query, in swish-e format
@@ -1486,17 +1507,6 @@ form 'backend:name'."
 ;;       (symbol-value key))
 ;;     ))
 
-(defmacro nnir-group-server (group)
-  "Returns the server for a foreign newsgroup in the format as gnus-server-to-method needs it. Compare to gnus-group-real-prefix and gnus-group-real-name."
-  `(let ((gname ,group))
-    (if (string-match "^\\([^:]+\\):" gname)
-       (setq gname (match-string 1 gname))
-      nil)
-    (if (string-match "^\\([^+]+\\)\\+\\(.+\\)$" gname)
-       (format "%s:%s" (match-string 1 gname) (match-string 2 gname))
-      (concat gname ":"))
-    ))
-
 (defun nnir-group-full-name (shortname server)
   "For the given group name, return a full Gnus group name.
 The Gnus backend/server information is added."
@@ -1557,3 +1567,5 @@ The Gnus backend/server information is added."
 
 ;; The end.
 (provide 'nnir)
+
+;;; arch-tag: 9b3fecf8-4397-4bbb-bf3c-6ac3cbbc6664