X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fnnir.el;h=846db89de1fe6748b1f8654f1d0eb939322da1c4;hb=9b741e050b400987d68ff761c6cc3276c932839c;hp=fb783180a311fead514baf32bda1a5bb8cc6fc4f;hpb=56184d80d4b07c737ac00d4cb16cdb43efa1b9f5;p=elisp%2Fgnus.git- diff --git a/lisp/nnir.el b/lisp/nnir.el index fb78318..846db89 100644 --- a/lisp/nnir.el +++ b/lisp/nnir.el @@ -1,8 +1,6 @@ ;;; 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 ;; Keywords: news, mail, searching, ir, glimpse, wais @@ -287,7 +285,7 @@ ;;; 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) @@ -461,6 +459,11 @@ that it is for EWS, not Glimpse." :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 . ;; Swish++ home page: http://homepage.mac.com/pauljlucas/software/swish/ @@ -968,6 +971,7 @@ pairs (also vectors, actually)." (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 @@ -981,13 +985,30 @@ pairs (also vectors, actually)." (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)) @@ -1217,13 +1238,9 @@ Tested with Namazu 2.0.6 on a GNU/Linux system." ,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))))