Fix nnir/gnus-sum mutually recursive requirements
[gnus] / lisp / nnir.el
index 17fc3f3..1d4f1c2 100644 (file)
@@ -1,6 +1,6 @@
 ;;; nnir.el --- search mail with various search engines -*- coding: iso-8859-1 -*-
 
-;; Copyright (C) 1998-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2012 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <grossjohann@ls6.cs.uni-dortmund.de>
 ;; Swish-e and Swish++ backends by:
@@ -290,9 +290,7 @@ is `(valuefunc member)'."
   (autoload 'nnimap-command "nnimap")
   (autoload 'nnimap-possibly-change-group "nnimap")
   (autoload 'nnimap-make-thread-query "nnimap")
-  (autoload 'gnus-registry-action "gnus-registry")
-  (defvar gnus-registry-install))
-
+  (autoload 'gnus-registry-action "gnus-registry"))
 
 (nnoo-declare nnir)
 (nnoo-define-basics nnir)
@@ -306,7 +304,7 @@ is `(valuefunc member)'."
 ;;; User Customizable Variables:
 
 (defgroup nnir nil
-  "Search groups in Gnus with assorted seach engines."
+  "Search groups in Gnus with assorted search engines."
   :group 'gnus)
 
 (defcustom nnir-ignored-newsgroups ""
@@ -672,7 +670,8 @@ Add an entry here when adding a new search engine.")
          (goto-char (point-min))
          (while (not (eobp))
            (let* ((novitem (funcall parsefunc))
-                  (artno (mail-header-number novitem))
+                  (artno (and novitem
+                              (mail-header-number novitem)))
                   (art (car (rassq artno articleids))))
              (when art
                (mail-header-set-number novitem art)
@@ -806,7 +805,7 @@ ready to be added to the list of search results."
     ;; remove trailing slash and, for nnmaildir, cur/new/tmp
     (setq dirnam
          (substring dirnam 0
-                    (if (string= (gnus-group-server server) "nnmaildir")
+                    (if (string-match "^nnmaildir:" (gnus-group-server server))
                         -5 -1)))
 
     ;; Set group to dirnam without any leading dots or slashes,
@@ -816,7 +815,7 @@ ready to be added to the list of search results."
                  "[/\\]" "." t)))
 
     (vector (gnus-group-full-name group server)
-           (if (string= (gnus-group-server server) "nnmaildir")
+           (if (string-match "^nnmaildir:" (gnus-group-server server))
                (nnmaildir-base-name-to-article-number
                 (substring article 0 (string-match ":" article))
                 group nil)
@@ -1073,7 +1072,8 @@ Windows NT 4.0."
           ;; is sufficient.  Note that we can't only use the value of
           ;; nnml-use-compressed-files because old articles might have been
           ;; saved with a different value.
-          (article-pattern (if (string= (gnus-group-server server) "nnmaildir")
+          (article-pattern (if (string-match "^nnmaildir:"
+                                             (gnus-group-server server))
                                ":[0-9]+"
                              "^[0-9]+\\(\\.[a-z0-9]+\\)?$"))
            score artno dirnam filenam)
@@ -1270,12 +1270,12 @@ Tested with swish-e-2.0.1 on Windows NT 4.0."
           ;; nnir-search failure reason is in this buffer, show it if
           ;; the user wants it.
           (when (> gnus-verbose 6)
-            (display-buffer nnir-tmp-buffer)))) ;; FIXME: Dont clear buffer !
+            (display-buffer nnir-tmp-buffer)))) ;; FIXME: Don't clear buffer !
       (message "Doing hyrex-search query \"%s\"...done" qstring)
       (sit-for 0)
       ;; nnir-search returns:
-      ;;   for nnml/nnfolder: "filename mailid weigth"
-      ;;   for nnimap:        "group mailid weigth"
+      ;;   for nnml/nnfolder: "filename mailid weight"
+      ;;   for nnimap:        "group mailid weight"
       (goto-char (point-min))
       (delete-non-matching-lines "^\\S + [0-9]+ [0-9]+$")
       ;; HyREX doesn't search directly in groups -- so filter out here.
@@ -1315,7 +1315,8 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
   ;; (when group
   ;;   (error "The Namazu backend cannot search specific groups"))
   (save-excursion
-    (let ((article-pattern (if (string= (gnus-group-server server) "nnmaildir")
+    (let ((article-pattern (if (string-match "^nnmaildir:"
+                                            (gnus-group-server server))
                               ":[0-9]+"
                             "^[0-9]+$"))
           artlist
@@ -1388,7 +1389,8 @@ actually)."
           (groupspec (cdr (assq 'group query)))
           (prefix (nnir-read-server-parm 'nnir-notmuch-remove-prefix server))
            artlist
-           (article-pattern (if (string= (gnus-group-server server) "nnmaildir")
+          (article-pattern (if (string-match "^nnmaildir:"
+                                             (gnus-group-server server))
                               ":[0-9]+"
                             "^[0-9]+$"))
            artno dirnam filenam)
@@ -1738,8 +1740,7 @@ environment unless `not-global' is non-nil."
   (when (eq (car (gnus-find-method-for-group gnus-newsgroup-name)) 'nnir)
     (setq gnus-summary-line-format
          (or nnir-summary-line-format gnus-summary-line-format))
-    (when (and (boundp 'gnus-registry-install)
-                      (eq gnus-registry-install t))
+    (when (gnus-bound-and-true-p 'gnus-registry-enabled)
       (remove-hook 'gnus-summary-article-delete-hook 'gnus-registry-action t)
       (remove-hook 'gnus-summary-article-move-hook 'gnus-registry-action t)
       (remove-hook 'gnus-summary-article-expire-hook 'gnus-registry-action t)