;;; nnir.el --- search mail with various search engines
;; Copyright (C) 1998 Kai Großjohann
-;; $Id: nnir.el,v 1.72 2001/08/17 11:15:13 grossjoh Exp $
-
;; Author: Kai Großjohann <grossjohann@ls6.cs.uni-dortmund.de>
;; Keywords: news, mail, searching, ir, glimpse, wais
;;; Setup Code:
-(defconst nnir-version "$Id: nnir.el,v 1.72 2001/08/17 11:15:13 grossjoh Exp $"
+(defconst nnir-version "1.72"
"Version of NNIR.")
(require 'cl)
:type '(regexp)
:group 'nnir)
+(defcustom nnir-imap-default-charset nil
+ "*Name of the charset of the strings that appear in the search criteria."
+ :type '(choice (const nil) symbol)
+ :group 'nnir)
+
;; Swish++. Next three variables Copyright (C) 2000, 2001 Christoph
;; Conrad <christoph.conrad@gmx.de>.
;; Swish++ home page: http://homepage.mac.com/pauljlucas/software/swish/
(defun nnir-run-imap (query &optional group)
(require 'imap)
(require 'nnimap)
+ (require 'mm-util)
(unless group
(error "Must specify groups for IMAP searching."))
(save-excursion
(setq buf nnimap-server-buffer) ;; xxx
(message "Searching %s..." group)
(let ((arts 0)
- (mbx (gnus-group-real-name group)))
+ (mbx (gnus-group-real-name group))
+ (multibyte-p (mm-multibyte-p))
+ charset coding-system)
(when (imap-mailbox-select mbx nil buf)
+ (with-temp-buffer
+ (if multibyte-p
+ (mm-enable-multibyte))
+ (insert qstring)
+ (setq charset (car (mm-find-mime-charset-region
+ (point-min)(point-max)))))
+ (unless charset
+ (setq charset nnir-imap-default-charset))
(mapcar
(lambda (artnum)
(push (vector mbx artnum 1) artlist)
(setq arts (1+ arts)))
- (imap-search (concat "TEXT \"" qstring "\"") buf))
+ (if (and (not (eq charset 'us-ascii))
+ (setq coding-system (mm-charset-to-coding-system
+ charset)))
+ (imap-search
+ (concat "CHARSET " (symbol-name charset) " TEXT \""
+ (mm-encode-coding-string qstring coding-system)
+ "\"") buf)
+ (imap-search (concat "TEXT \"" qstring "\"") buf)))
(message "Searching %s... %d matches" mbx arts)))
(message "Searching %s...done" group))
(quit nil))
,nnir-namazu-index-directory ; index directory
))
(exitstatus
- (let ((process-environment process-environment))
- ;; Disable locale of Namazu.
- (dolist (env process-environment)
- (when (string-match "\
-\\`\\(L\\(ANG\\|C_\\(ALL\\|CTYPE\\|COLLATE\\|TIME\\|NUMERIC\\|MONETARY\\|MESSAGES\\)\\)\\)=" env)
- (setenv (match-string 1 env) nil)))
- (setenv "LANG" "C")
+ (let ((process-environment (copy-sequence process-environment)))
+ ;; Disable locale.
+ (setenv "LC_ALL" "C")
(message "%s args: %s" nnir-namazu-program
(mapconcat 'identity (cddddr cp-list) " "))
(apply 'call-process cp-list))))