From: Andrew Cohen <cohen@andy.bu.edu>
To: ding@gnus.org
Subject: Re: large nnir changes
Date: Sat, 30 Oct 2010 13:45:01 -0400 [thread overview]
Message-ID: <87mxpvo9r6.fsf@andy.bu.edu> (raw)
In-Reply-To: <m3vd4joc5g.fsf@quimbies.gnus.org>
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
>>>>> "Lars" == Lars Magne Ingebrigtsen <larsi@gnus.org> writes:
Lars> Looks good to me, although compiling warned about using the
Lars> undefined `nnir-search-engine' variable, so I resurrected
Lars> that. Feel free to clean that up, since it's probably the
Lars> wrong thing to do...
Oops, I forgot to check byte-compiler warnings. I took the opportunity
to move things around to keep the defs better organized.
Out of curiosity how often does the xapian index get updated on gmane?
Cheers,
Andy
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnir fix --]
[-- Type: text/x-diff, Size: 8336 bytes --]
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index af2104a..18dbfa4 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2010-10-30 Andrew Cohen <cohen@andy.bu.edu>
+
+ * nnir.el move defvar, defcustom around to keep file organized and keep
+ byte-compiler quiet.
+ (nnir-read-parms): accept search-engine as arg.
+ (nnir-run-query): pass search-engine as arg.
+ (nnir-search-engine): remove.
+
2010-10-30 Lars Magne Ingebrigtsen <larsi@gnus.org>
* shr.el (shr-generic): The text nodes should be text, not :text.
diff --git a/lisp/nnir.el b/lisp/nnir.el
index bb64f87..9e3dd9c 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -183,88 +183,6 @@
(gnus-declare-backend "nnir" 'mail)
-(defvar nnir-imap-search-arguments
- '(("Whole message" . "TEXT")
- ("Subject" . "SUBJECT")
- ("To" . "TO")
- ("From" . "FROM")
- ("Imap" . ""))
- "Mapping from user readable keys to IMAP search items for use in nnir")
-
-(defvar nnir-imap-search-other "HEADER %S"
- "The IMAP search item to use for anything other than
- `nnir-imap-search-arguments'. By default this is the name of an
- email header field")
-
-(defvar nnir-imap-search-argument-history ()
- "The history for querying search options in nnir")
-
-(defvar nnir-search-history ()
- "The history for querying search options in nnir")
-
-(defvar nnir-get-article-nov-override-function nil
- "If non-nil, a function that will be passed each search result. This
-should return a message's headers in NOV format.
-
-If this variable is nil, or if the provided function returns nil for a search
-result, `gnus-retrieve-headers' will be called instead.")
-
-;;; Developer Extension Variable:
-
-(defcustom nnir-search-engine 'wais
- "*The search engine to use. Must be a symbol.
-See `nnir-engines' for a list of supported engines, and for example
-settings of `nnir-search-engine'."
- :type '(sexp)
- :group 'nnir)
-
-(defcustom nnir-imap-default-search-key "Whole message"
- "*The default IMAP search key for an nnir search. Must be one of
- the keys in `nnir-imap-search-arguments'. To use raw imap queries
- by default set this to \"Imap\""
- :type '(string)
- :group 'nnir)
-
-(defvar nnir-engines
- `((wais nnir-run-waissearch
- ())
- (imap nnir-run-imap
- ((criteria
- "Imap Search in" ; Prompt
- ,(mapcar 'car nnir-imap-search-arguments) ; alist for completing
- nil ; allow any user input
- nil ; initial value
- nnir-imap-search-argument-history ; the history to use
- ,nnir-imap-default-search-key ; default
- )))
- (gmane nnir-run-gmane
- ((author . "Gmane Author: ")))
- (swish++ nnir-run-swish++
- ((group . "Swish++ Group spec: ")))
- (swish-e nnir-run-swish-e
- ((group . "Swish-e Group spec: ")))
- (namazu nnir-run-namazu
- ())
- (hyrex nnir-run-hyrex
- ((group . "Hyrex Group spec: ")))
- (find-grep nnir-run-find-grep
- ((grep-options . "Grep options: "))))
- "Alist of supported search engines.
-Each element in the alist is a three-element list (ENGINE FUNCTION ARGS).
-ENGINE is a symbol designating the searching engine. FUNCTION is also
-a symbol, giving the function that does the search. The third element
-ARGS is a list of cons pairs (PARAM . PROMPT). When issuing a query,
-the FUNCTION will issue a query for each of the PARAMs, using PROMPT.
-
-The value of `nnir-search-engine' must be one of the ENGINE symbols.
-For example, for searching a server using namazu include
- (nnir-search-engine namazu)
-in the server definition. Note that you have to set additional
-variables for most backends. For example, the `namazu' backend
-needs the variables `nnir-namazu-program',
-`nnir-namazu-index-directory' and `nnir-namazu-remove-prefix'.
-
-Add an entry here when adding a new search engine.")
;;; User Customizable Variables:
@@ -279,6 +197,13 @@ Add an entry here when adding a new search engine.")
:type '(alist)
:group 'nnir)
+(defcustom nnir-imap-default-search-key "Whole message"
+ "*The default IMAP search key for an nnir search. Must be one of
+ the keys in `nnir-imap-search-arguments'. To use raw imap queries
+ by default set this to \"Imap\""
+ :type '(string)
+ :group 'nnir)
+
(defcustom nnir-wais-program "waissearch"
"*Name of waissearch executable."
:type '(string)
@@ -463,6 +388,74 @@ arrive at the correct group name, \"mail.misc\"."
:type '(directory)
:group 'nnir)
+;; Imap variables
+
+(defvar nnir-imap-search-arguments
+ '(("Whole message" . "TEXT")
+ ("Subject" . "SUBJECT")
+ ("To" . "TO")
+ ("From" . "FROM")
+ ("Imap" . ""))
+ "Mapping from user readable keys to IMAP search items for use in nnir")
+
+(defvar nnir-imap-search-other "HEADER %S"
+ "The IMAP search item to use for anything other than
+ `nnir-imap-search-arguments'. By default this is the name of an
+ email header field")
+
+(defvar nnir-imap-search-argument-history ()
+ "The history for querying search options in nnir")
+
+;;; Developer Extension Variable:
+
+(defvar nnir-engines
+ `((wais nnir-run-waissearch
+ ())
+ (imap nnir-run-imap
+ ((criteria
+ "Imap Search in" ; Prompt
+ ,(mapcar 'car nnir-imap-search-arguments) ; alist for completing
+ nil ; allow any user input
+ nil ; initial value
+ nnir-imap-search-argument-history ; the history to use
+ ,nnir-imap-default-search-key ; default
+ )))
+ (gmane nnir-run-gmane
+ ((author . "Gmane Author: ")))
+ (swish++ nnir-run-swish++
+ ((group . "Swish++ Group spec: ")))
+ (swish-e nnir-run-swish-e
+ ((group . "Swish-e Group spec: ")))
+ (namazu nnir-run-namazu
+ ())
+ (hyrex nnir-run-hyrex
+ ((group . "Hyrex Group spec: ")))
+ (find-grep nnir-run-find-grep
+ ((grep-options . "Grep options: "))))
+ "Alist of supported search engines.
+Each element in the alist is a three-element list (ENGINE FUNCTION ARGS).
+ENGINE is a symbol designating the searching engine. FUNCTION is also
+a symbol, giving the function that does the search. The third element
+ARGS is a list of cons pairs (PARAM . PROMPT). When issuing a query,
+the FUNCTION will issue a query for each of the PARAMs, using PROMPT.
+
+The value of `nnir-search-engine' must be one of the ENGINE symbols.
+For example, for searching a server using namazu include
+ (nnir-search-engine namazu)
+in the server definition. Note that you have to set additional
+variables for most backends. For example, the `namazu' backend
+needs the variables `nnir-namazu-program',
+`nnir-namazu-index-directory' and `nnir-namazu-remove-prefix'.
+
+Add an entry here when adding a new search engine.")
+
+(defvar nnir-get-article-nov-override-function nil
+ "If non-nil, a function that will be passed each search result. This
+should return a message's headers in NOV format.
+
+If this variable is nil, or if the provided function returns nil for a search
+result, `gnus-retrieve-headers' will be called instead.")
+
;;; Internal Variables:
(defvar nnir-current-query nil
@@ -480,6 +473,9 @@ arrive at the correct group name, \"mail.misc\"."
(defvar nnir-tmp-buffer " *nnir*"
"Internal: temporary buffer.")
+(defvar nnir-search-history ()
+ "Internal: the history for querying search options in nnir")
+
(defvar nnir-extra-parms nil
"Internal: stores request for extra search parms")
@@ -1431,7 +1427,7 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
;;; Util Code:
-(defun nnir-read-parms (query)
+(defun nnir-read-parms (query nnir-search-engine)
"Reads additional search parameters according to `nnir-engines'."
(let ((parmspec (caddr (assoc nnir-search-engine nnir-engines))))
(nconc query
@@ -1472,7 +1468,7 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
(if search-func
(funcall search-func
(if nnir-extra-parms
- (nnir-read-parms q)
+ (nnir-read-parms q nnir-search-engine)
q)
server (cdr x))
nil)))
next prev parent reply other threads:[~2010-10-30 17:45 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-30 14:06 Andrew Cohen
2010-10-30 16:53 ` Lars Magne Ingebrigtsen
2010-10-30 17:45 ` Andrew Cohen [this message]
2010-10-30 17:49 ` Lars Magne Ingebrigtsen
2010-10-31 21:52 ` Andrew Cohen
2010-10-31 21:54 ` Lars Magne Ingebrigtsen
2010-11-01 23:23 ` Andrew Cohen
2010-11-01 23:37 ` Lars Magne Ingebrigtsen
2010-10-31 23:17 ` Dan Christensen
2010-10-31 23:47 ` Andrew Cohen
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=87mxpvo9r6.fsf@andy.bu.edu \
--to=cohen@andy.bu.edu \
--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).