;;; nnir.el --- search mail with various search engines -*- coding: utf-8 -*-
-;; Copyright (C) 1998-2013 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2015 Free Software Foundation, Inc.
;; Author: Kai Großjohann <grossjohann@ls6.cs.uni-dortmund.de>
;; Swish-e and Swish++ backends by:
;;; Setup:
-;; For Emacs <22.2 and XEmacs.
-(eval-and-compile
- (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
-
(require 'nnoo)
(require 'gnus-group)
(require 'message)
(require 'gnus-sum)
-(eval-when-compile
- (autoload 'nnimap-buffer "nnimap")
- (autoload 'nnimap-command "nnimap")
- (autoload 'nnimap-change-group "nnimap")
- (autoload 'nnimap-make-thread-query "nnimap")
- (autoload 'gnus-registry-action "gnus-registry")
- (autoload 'gnus-registry-get-id-key "gnus-registry")
- (autoload 'gnus-group-topic-name "gnus-topic"))
-
-
(nnoo-declare nnir)
(nnoo-define-basics nnir)
If nil this will use `gnus-summary-line-format'."
:version "24.1"
- :type '(string)
+ :type '(choice (const :tag "gnus-summary-line-format" nil) string)
:group 'nnir)
(defcustom nnir-retrieve-headers-override-function nil
If this variable is nil, or if the provided function returns nil for a search
result, `gnus-retrieve-headers' will be called instead."
:version "24.1"
- :type '(function)
+ :type '(choice (const :tag "gnus-retrieve-headers" nil) function)
:group 'nnir)
(defcustom nnir-imap-default-search-key "whole message"
(defcustom nnir-swish++-additional-switches '()
"*A list of strings, to be given as additional arguments to swish++.
-Note that this should be a list. Ie, do NOT use the following:
+Note that this should be a list. I.e., do NOT use the following:
(setq nnir-swish++-additional-switches \"-i -w\") ; wrong
Instead, use this:
- (setq nnir-swish++-additional-switches '(\"-i\" \"-w\"))"
+ (setq nnir-swish++-additional-switches \\='(\"-i\" \"-w\"))"
:type '(repeat (string))
:group 'nnir)
(defcustom nnir-swish-e-additional-switches '()
"*A list of strings, to be given as additional arguments to swish-e.
-Note that this should be a list. Ie, do NOT use the following:
+Note that this should be a list. I.e., do NOT use the following:
(setq nnir-swish-e-additional-switches \"-i -w\") ; wrong
Instead, use this:
- (setq nnir-swish-e-additional-switches '(\"-i\" \"-w\"))
+ (setq nnir-swish-e-additional-switches \\='(\"-i\" \"-w\"))
This could be a server parameter."
:type '(repeat (string))
(defcustom nnir-hyrex-additional-switches '()
"*A list of strings, to be given as additional arguments for nnir-search.
-Note that this should be a list. Ie, do NOT use the following:
+Note that this should be a list. I.e., do NOT use the following:
(setq nnir-hyrex-additional-switches \"-ddl ddl.xml -c nnir\") ; wrong !
Instead, use this:
- (setq nnir-hyrex-additional-switches '(\"-ddl\" \"ddl.xml\" \"-c\" \"nnir\"))"
+ (setq nnir-hyrex-additional-switches \\='(\"-ddl\" \"ddl.xml\" \"-c\" \"nnir\"))"
:type '(repeat (string))
:group 'nnir)
The switches `-q', `-a', and `-s' are always used, very few other switches
make any sense in this context.
-Note that this should be a list. Ie, do NOT use the following:
+Note that this should be a list. I.e., do NOT use the following:
(setq nnir-namazu-additional-switches \"-i -w\") ; wrong
Instead, use this:
- (setq nnir-namazu-additional-switches '(\"-i\" \"-w\"))"
+ (setq nnir-namazu-additional-switches \\='(\"-i\" \"-w\"))"
:type '(repeat (string))
:group 'nnir)
(defcustom nnir-notmuch-additional-switches '()
"*A list of strings, to be given as additional arguments to notmuch.
-Note that this should be a list. Ie, do NOT use the following:
+Note that this should be a list. I.e., do NOT use the following:
(setq nnir-notmuch-additional-switches \"-i -w\") ; wrong
Instead, use this:
- (setq nnir-notmuch-additional-switches '(\"-i\" \"-w\"))"
+ (setq nnir-notmuch-additional-switches \\='(\"-i\" \"-w\"))"
:version "24.1"
:type '(repeat (string))
:group 'nnir)
(gmane nnir-run-gmane
((gmane-author . "Gmane Author: ")))
(swish++ nnir-run-swish++
- ((swish++-group . "Swish++ Group spec: ")))
+ ((swish++-group . "Swish++ Group spec (regexp): ")))
(swish-e nnir-run-swish-e
- ((swish-e-group . "Swish-e Group spec: ")))
+ ((swish-e-group . "Swish-e Group spec (regexp): ")))
(namazu nnir-run-namazu
())
(notmuch nnir-run-notmuch
())
(hyrex nnir-run-hyrex
- ((hyrex-group . "Hyrex Group spec: ")))
+ ((hyrex-group . "Hyrex Group spec (regexp): ")))
(find-grep nnir-run-find-grep
((grep-options . "Grep options: "))))
"Alist of supported search engines.
;; Gnus glue.
+(declare-function gnus-group-topic-name "gnus-topic" ())
+
(defun gnus-group-make-nnir-group (nnir-extra-parms &optional specs)
"Create an nnir group. Prompt for a search query and determine
the groups to search as follows: if called from the *Server*
(deffoo nnir-request-update-mark (group article mark)
(let ((artgroup (nnir-article-group article))
(artnumber (nnir-article-number article)))
- (gnus-request-update-mark artgroup artnumber mark)))
+ (when (and artgroup artnumber)
+ (gnus-request-update-mark artgroup artnumber mark))))
(deffoo nnir-request-set-mark (group actions &optional server)
+ (nnir-possibly-change-group group server)
(let (mlist)
(dolist (action actions)
(destructuring-bind (range action marks) action
(deffoo nnir-request-update-info (group info &optional server)
- (nnir-possibly-change-group group)
+ (nnir-possibly-change-group group server)
;; clear out all existing marks.
(gnus-info-set-marks info nil)
(gnus-info-set-read info nil)
(deffoo nnir-close-group (group &optional server)
+ (nnir-possibly-change-group group server)
(let ((pgroup (gnus-group-guess-full-name-from-command-method group)))
(when (and nnir-artlist (not (gnus-ephemeral-group-p pgroup)))
(gnus-group-set-parameter pgroup 'nnir-artlist nnir-artlist))
;;; Search Engine Interfaces:
+(autoload 'nnimap-change-group "nnimap")
+(declare-function nnimap-buffer "nnimap" ())
+(declare-function nnimap-command "nnimap" (&rest args))
+
;; imap interface
(defun nnir-run-imap (query srv &optional groups)
"Run a search against an IMAP back-end server.
(goto-char (point-min))
(while (re-search-forward
- "^\\([0-9]+\\.\\).*\\((score: \\([0-9]+\\)\\))\n\\([^ ]+\\)"
+ "^\\([0-9,]+\\.\\).*\\((score: \\([0-9]+\\)\\))\n\\([^ ]+\\)"
nil t)
(setq score (match-string 3)
group (file-name-directory (match-string 4))
(let ((backend (car (gnus-server-to-method server))))
(nnoo-current-server-p (or backend 'nnir) server)))
+(autoload 'nnimap-make-thread-query "nnimap")
+(declare-function gnus-registry-get-id-key "gnus-registry" (id key))
+
(defun nnir-search-thread (header)
"Make an nnir group based on the thread containing the article
header. The current server will be searched. If the registry is
(forward-line)))))
groups))
+;; Behind gnus-registry-enabled test.
+(declare-function gnus-registry-action "gnus-registry"
+ (action data-header from &optional to method))
+
(defun nnir-registry-action (action data-header from &optional to method)
"Call `gnus-registry-action' with the original article group."
(gnus-registry-action