[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/mh-e/mh-index.el
From: |
Bill Wohler |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/mh-e/mh-index.el |
Date: |
Sat, 28 May 2005 18:04:58 -0400 |
Index: emacs/lisp/mh-e/mh-index.el
diff -c emacs/lisp/mh-e/mh-index.el:1.9 emacs/lisp/mh-e/mh-index.el:1.10
*** emacs/lisp/mh-e/mh-index.el:1.9 Wed May 18 11:01:20 2005
--- emacs/lisp/mh-e/mh-index.el Sat May 28 22:04:54 2005
***************
*** 1,6 ****
;;; mh-index -- MH-E interface to indexing programs
! ;; Copyright (C) 2005 Free Software Foundation, Inc.
;; Author: Satyaki Das <address@hidden>
;; Maintainer: Bill Wohler <address@hidden>
--- 1,6 ----
;;; mh-index -- MH-E interface to indexing programs
! ;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
;; Author: Satyaki Das <address@hidden>
;; Maintainer: Bill Wohler <address@hidden>
***************
*** 31,36 ****
--- 31,37 ----
;;; swish-e
;;; mairix
;;; namazu
+ ;;; pick
;;; grep
;;;
;;; (2) To use this package, you first have to build an index. Please read
***************
*** 352,394 ****
(defun* mh-index-search (redo-search-flag folder search-regexp
&optional window-config)
"Perform an indexed search in an MH mail folder.
! Use a prefix argument to repeat the search, as in REDO-SEARCH-FLAG below.
! If REDO-SEARCH-FLAG is non-nil and the current folder buffer was generated by
a
! index search, then the search is repeated. Otherwise, FOLDER is searched with
! SEARCH-REGEXP and the results are presented in an MH-E folder. If FOLDER is
! \"+\" then mail in all folders are searched. Optional argument WINDOW-CONFIG
! stores the window configuration that will be restored after the user quits the
! folder containing the index search results.
!
! Four indexing programs are supported; if none of these are present, then grep
! is used. This function picks the first program that is available on your
! system. If you would prefer to use a different program, set the customization
! variable `mh-index-program' accordingly.
!
! The documentation for the following functions describes how to generate the
! index for each program:
- `mh-swish++-execute-search'
- `mh-swish-execute-search'
- `mh-mairix-execute-search'
- `mh-namazu-execute-search'
-
- If none of these programs are present then we use pick. If desired grep can be
- used instead. Details about these methods can be found in:
-
- `mh-pick-execute-search'
- `mh-grep-execute-search'
! This and related functions use an X-MHE-Checksum header to cache the MD5
! checksum of a message. This means that already present X-MHE-Checksum headers
! in the incoming email could result in messages not being found. The following
! procmail recipe should avoid this:
!
! :0 wf
! | formail -R \"X-MHE-Checksum\" \"Old-X-MHE-Checksum\"
!
! This has the effect of renaming already present X-MHE-Checksum headers."
(interactive
(list current-prefix-arg
(progn
--- 353,426 ----
(defun* mh-index-search (redo-search-flag folder search-regexp
&optional window-config)
"Perform an indexed search in an MH mail folder.
! Use a prefix argument to repeat the search.
! Unlike regular searches, the prompt for the folder to search can be `all' to
! search all folders; in addition, the search works recursively on the listed
! folder. The search criteria are entered in an MH-Pick buffer as described in
! `mh-search-folder'.
!
! To perform the search, type \\<mh-pick-mode-map>\\[mh-do-search]. Another
! difference from the regular searches is that because the search operates on
! more than one folder, the messages that are found are put in a temporary
! sub-folder of `+mhe-index' and are displayed in an MH-Folder buffer. This
! buffer is special because it displays messages from multiple folders; each set
! of messages from a given folder has a heading with the folder name.
!
! In addition, the \\<mh-folder-mode-map>\\[mh-index-visit-folder] command can
! be used to visit the folder of the message at point. Initially, only the
! messages that matched the search criteria are displayed in the folder. While
! the temporary buffer has its own set of message numbers, the actual messages
! numbers are shown in the visited folder. Thus, the \\[mh-index-visit-folder]
! command is useful to find the actual message number of an interesting message,
! or to view surrounding messages with the \\[mh-rescan-folder] command.
!
! Because this folder is temporary, you'll probably get in the habit of killing
! it when you're done with \\[mh-kill-folder].
!
! If you have run the \\[mh-search-folder] command, but change your mind while
! entering the search criteria and actually want to run an indexed search, then
! you can use the \\<mh-pick-mode-map>\\[mh-index-do-search] command in the
! MH-Pick buffer.
!
! The \\<mh-folder-mode-map>\\[mh-index-search] command runs the command defined
! by the `mh-index-program' option. The default value is \"Auto-detect\" which
! means that MH-E will automatically choose one of \"swish++\", \"swish-e\",
! \"mairix\", \"namazu\", \"pick\" and \"grep\" in that order. If, for example,
! you have both \"swish++\" and \"mairix\" installed and you want to use
! \"mairix\", then you can set this option to \"mairix\".
!
! *NOTE*
!
! The \"pick\" and \"grep\" commands do not perform a recursive search on
! the given folder.
!
! This command uses an \"X-MHE-Checksum:\" header field to cache the MD5
! checksum of a message. This means that if an incoming message already contains
! an \"X-MHE-Checksum:\" field, that message might not be found by this command.
! The following \"procmail\" recipe avoids this problem by renaming the existing
! header field:
!
! :0 wf
! | formail -R \"X-MHE-Checksum\" \"X-Old-MHE-Checksum\"
!
! The documentation for the following commands describe how to set up the
! various indexing programs to use with MH-E. The \"pick\" and \"grep\" commands
! do not require additional configuration.
- `mh-swish++-execute-search'
- `mh-swish-execute-search'
- `mh-mairix-execute-search'
- `mh-namazu-execute-search'
- `mh-pick-execute-search'
- `mh-grep-execute-search'
! In a program, if REDO-SEARCH-FLAG is non-nil and the current folder buffer was
! generated by a index search, then the search is repeated. Otherwise, FOLDER is
! searched with SEARCH-REGEXP and the results are presented in an MH-E folder.
! If FOLDER is \"+\" then mail in all folders are searched. Optional argument
! WINDOW-CONFIG stores the window configuration that will be restored after the
! user quits the folder containing the index search results."
(interactive
(list current-prefix-arg
(progn
***************
*** 998,1005 ****
in the folder itself and does not descend into any sub-folders that may be
present.
! FOLDER-PATH is the directory containing the mails to be searched and
! SEARCH-REGEXP is the pattern that pick gets."
(set-buffer (get-buffer-create mh-index-temp-buffer))
(erase-buffer)
(setq mh-index-pick-folder
--- 1030,1037 ----
in the folder itself and does not descend into any sub-folders that may be
present.
! In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used
! to search."
(set-buffer (get-buffer-create mh-index-temp-buffer))
(erase-buffer)
(setq mh-index-pick-folder
***************
*** 1029,1035 ****
(defun mh-grep-execute-search (folder-path search-regexp)
"Execute grep and read the results.
! FOLDER-PATH is the directory in which SEARCH-REGEXP is used to search."
(set-buffer (get-buffer-create mh-index-temp-buffer))
(erase-buffer)
(call-process mh-grep-binary nil '(t nil) nil
--- 1061,1073 ----
(defun mh-grep-execute-search (folder-path search-regexp)
"Execute grep and read the results.
!
! Unlike the other index search programs \"grep\" only searches messages present
! in the folder itself and does not descend into any sub-folders that may be
! present.
!
! In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used
! to search."
(set-buffer (get-buffer-create mh-index-temp-buffer))
(erase-buffer)
(call-process mh-grep-binary nil '(t nil) nil
***************
*** 1081,1114 ****
(defun mh-mairix-execute-search (folder-path search-regexp-list)
"Execute mairix and read the results.
! In the examples below replace /home/user/Mail with the path to your MH
directory.
! First create the directory /home/user/Mail/.mairix. Then create the file
! /home/user/Mail/.mairix/config with the following contents:
! # This should contain the same thing as your `mh-user-path'
! base=/home/user/Mail
! # List of folders that should be indexed. 3 dots at the end means there are
! # subfolders within the folder
! mh_folders=archive...:inbox:drafts:news:sent:trash
! vfolder_format=raw
! database=/home/user/Mail/mairix/database
Use the following command line to generate the mairix index. Run this daily
from cron:
! mairix -f /home/user/Mail/.mairix/config
! FOLDER-PATH is the directory in which SEARCH-REGEXP-LIST is used to search."
(set-buffer (get-buffer-create mh-index-temp-buffer))
(erase-buffer)
(unless mh-mairix-binary
(error "Set mh-mairix-binary appropriately"))
(apply #'call-process mh-mairix-binary nil '(t nil) nil
! "-f" (format "%s%s/config" mh-user-path mh-mairix-directory)
search-regexp-list)
(goto-char (point-min))
(setq mh-mairix-folder
--- 1119,1152 ----
(defun mh-mairix-execute-search (folder-path search-regexp-list)
"Execute mairix and read the results.
! In the examples below, replace \"/home/user/Mail\" with the path to your MH
directory.
! First create the directory \"/home/user/Mail/.mairix\". Then create the file
! \"/home/user/Mail/.mairix/config\" with the following contents:
! base=/home/user/Mail
! # List of folders that should be indexed. 3 dots at the end means there
! # are subfolders within the folder
! mh=archive...:inbox:drafts:news:sent:trash
! vfolder_format=raw
! database=/home/user/Mail/mairix/database
Use the following command line to generate the mairix index. Run this daily
from cron:
! mairix -f /home/user/Mail/.mairix/config
! In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP-LIST is used
! to search."
(set-buffer (get-buffer-create mh-index-temp-buffer))
(erase-buffer)
(unless mh-mairix-binary
(error "Set mh-mairix-binary appropriately"))
(apply #'call-process mh-mairix-binary nil '(t nil) nil
! "-r" "-f" (format "%s%s/config" mh-user-path mh-mairix-directory)
search-regexp-list)
(goto-char (point-min))
(setq mh-mairix-folder
***************
*** 1167,1176 ****
(let ((expr-list (cdr conjunct))
(expr-string ""))
(dolist (e expr-list)
! (setq expr-string (concat expr-string "+"
(if (atom e) "" "~")
(if (atom e) e (cadr e)))))
! (setq final (concat final "," (substring expr-string 1)))))
(substring final 1)))
result)))
result))
--- 1205,1214 ----
(let ((expr-list (cdr conjunct))
(expr-string ""))
(dolist (e expr-list)
! (setq expr-string (concat expr-string ","
(if (atom e) "" "~")
(if (atom e) e (cadr e)))))
! (setq final (concat final "/" (substring expr-string 1)))))
(substring final 1)))
result)))
result))
***************
*** 1327,1378 ****
(defun mh-swish-execute-search (folder-path search-regexp)
"Execute swish-e and read the results.
! In the examples below, replace /home/user/Mail with the path to your MH
! directory.
! First create the directory /home/user/Mail/.swish. Then create the file
! /home/user/Mail/.swish/config with the following contents:
! IndexDir /home/user/Mail
! IndexFile /home/user/Mail/.swish/index
! IndexName \"Mail Index\"
! IndexDescription \"Mail Index\"
! IndexPointer \"http://nowhere\"
! IndexAdmin \"nobody\"
! #MetaNames automatic
! IndexReport 3
! FollowSymLinks no
! UseStemming no
! IgnoreTotalWordCountWhenRanking yes
! WordCharacters abcdefghijklmnopqrstuvwxyz0123456789-
! BeginCharacters abcdefghijklmnopqrstuvwxyz
! EndCharacters abcdefghijklmnopqrstuvwxyz0123456789
! IgnoreLimit 50 1000
! IndexComments 0
! FileRules pathname contains /home/user/Mail/.swish
! FileRules pathname contains /home/user/Mail/mhe-index
! FileRules filename is index
! FileRules filename is \\..*
! FileRules filename is #.*
! FileRules filename is ,.*
! FileRules filename is .*~
If there are any directories you would like to ignore, append lines like the
! following to config:
!
! FileRules pathname contains /home/user/Mail/scripts
! You do not want to index the folders that hold the results of your searches
! since they tend to be ephemeral and the original messages are indexed anyway.
! The configuration file above assumes that the results are found in sub-folders
! of `mh-index-folder' which is +mhe-index by default.
! Use the following command line to generate the swish index. Run this
! daily from cron:
! swish-e -c /home/user/Mail/.swish/config
! FOLDER-PATH is the directory in which SEARCH-REGEXP is used to search."
(set-buffer (get-buffer-create mh-index-temp-buffer))
(erase-buffer)
(unless mh-swish-binary
--- 1365,1413 ----
(defun mh-swish-execute-search (folder-path search-regexp)
"Execute swish-e and read the results.
! In the examples below, replace \"/home/user/Mail\" with the path to your
! MH directory.
! First create the directory \"/home/user/Mail/.swish\". Then create the file
! \"/home/user/Mail/.swish/config\" with the following contents:
! DefaultContents TXT*
! IndexDir /home/user/Mail
! IndexFile /home/user/Mail/.swish/index
! IndexName \"Mail Index\"
! IndexDescription \"Mail Index\"
! IndexPointer \"http://nowhere\"
! IndexAdmin \"nobody\"
! #MetaNames automatic
! IndexReport 3
! FollowSymLinks no
! UseStemming no
! IgnoreTotalWordCountWhenRanking yes
! WordCharacters abcdefghijklmnopqrstuvwxyz0123456789-
! BeginCharacters abcdefghijklmnopqrstuvwxyz
! EndCharacters abcdefghijklmnopqrstuvwxyz0123456789
! IgnoreLimit 50 1000
! IndexComments 0
! FileRules filename contains \\D
! FileRules pathname contains /home/user/Mail/.swish
! FileRules pathname contains /home/user/Mail/mhe-index
!
! This configuration does not index the folders that hold the results of your
! searches in \"+mhe-index\" since they tend to be ephemeral and the original
! messages are indexed anyway.
If there are any directories you would like to ignore, append lines like the
! following to \"config\":
! FileRules pathname contains /home/user/Mail/scripts
! Use the following command line to generate the swish index. Run this daily
! from cron:
! swish-e -c /home/user/Mail/.swish/config
! In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used to
! search."
(set-buffer (get-buffer-create mh-index-temp-buffer))
(erase-buffer)
(unless mh-swish-binary
***************
*** 1407,1413 ****
(list (let* ((s (buffer-substring-no-properties start (1+
(point)))))
(unless (string-match mh-swish-folder s)
(return 'error))
! (if (string-match mh-user-path s)
(format "+%s"
(substring s (match-end 0) (1- (length s))))
(return 'error)))
--- 1442,1449 ----
(list (let* ((s (buffer-substring-no-properties start (1+
(point)))))
(unless (string-match mh-swish-folder s)
(return 'error))
! (if (and (string-match mh-user-path s)
! (< (match-end 0) (1- (length s))))
(format "+%s"
(substring s (match-end 0) (1- (length s))))
(return 'error)))
***************
*** 1431,1464 ****
(defun mh-swish++-execute-search (folder-path search-regexp)
"Execute swish++ and read the results.
! In the examples below, replace /home/user/Mail with the path to your MH
directory.
! First create the directory /home/user/Mail/.swish++. Then create the file
! /home/user/Mail/.swish++/swish++.conf with the following contents:
! IncludeMeta Bcc Cc Comments Content-Description From Keywords
! IncludeMeta Newsgroups Resent-To Subject To
! IncludeMeta Message-Id References In-Reply-To
! IncludeFile Mail *
! IndexFile /home/user/Mail/.swish++/swish++.index
!
! Use the following command line to generate the swish index. Run this
! daily from cron:
!
! find /home/user/Mail -path /home/user/Mail/mhe-index -prune \\
! -o -path /home/user/Mail/.swish++ -prune \\
! -o -name \"[0-9]*\" -print \\
! | index -c /home/user/Mail/.swish++/swish++.conf /home/user/Mail
!
! You do not want to index the folders that hold the results of your searches
! since they tend to be ephemeral and the original messages are indexed anyway.
! The command above assumes that the results are found in sub-folders of
! `mh-index-folder' which is +mhe-index by default.
! On some systems (Debian GNU/Linux, for example), use index++ instead of index.
! FOLDER-PATH is the directory in which SEARCH-REGEXP is used to search."
(set-buffer (get-buffer-create mh-index-temp-buffer))
(erase-buffer)
(unless mh-swish++-binary
--- 1467,1501 ----
(defun mh-swish++-execute-search (folder-path search-regexp)
"Execute swish++ and read the results.
! In the examples below, replace \"/home/user/Mail\" with the path to your MH
directory.
! First create the directory \"/home/user/Mail/.swish++\". Then create the file
! \"/home/user/Mail/.swish++/swish++.conf\" with the following contents:
! IncludeMeta Bcc Cc Comments Content-Description From Keywords
! IncludeMeta Newsgroups Resent-To Subject To
! IncludeMeta Message-Id References In-Reply-To
! IncludeFile Mail *
! IndexFile /home/user/Mail/.swish++/swish++.index
!
! Use the following command line to generate the swish index. Run this daily
! from cron:
! find /home/user/Mail -path /home/user/Mail/mhe-index -prune \\
! -o -path /home/user/Mail/.swish++ -prune \\
! -o -name \"[0-9]*\" -print \\
! | index -c /home/user/Mail/.swish++/swish++.conf -
!
! This command does not index the folders that hold the results of your searches
! in \"+mhe-index\" since they tend to be ephemeral and the original messages
! are indexed anyway.
! On some systems (Debian GNU/Linux, for example), use \"index++\" instead of
! \"index\".
!
! In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used to
! search."
(set-buffer (get-buffer-create mh-index-temp-buffer))
(erase-buffer)
(unless mh-swish++-binary
***************
*** 1512,1543 ****
(defun mh-namazu-execute-search (folder-path search-regexp)
"Execute namazu and read the results.
! In the examples below, replace /home/user/Mail with the path to your MH
directory.
! First create the directory /home/user/Mail/.namazu. Then create the file
! /home/user/Mail/.namazu/mknmzrc with the following contents:
!
! package conf; # Don't remove this line!
! $ADDRESS = 'address@hidden';
! $ALLOW_FILE = \"[0-9]*\";
! $EXCLUDE_PATH = \"^/home/user/Mail/(mhe-index|spam)\";
! In the above example configuration, none of the mail files contained in the
! directories /home/user/Mail/mhe-index and /home/user/Mail/spam are indexed.
! You do not want to index the folders that hold the results of your searches
! since they tend to be ephemeral and the original messages are indexed anyway.
! The configuration file above assumes that the results are found in sub-folders
! of `mh-index-folder' which is +mhe-index by default.
!
! Use the following command line to generate the namazu index. Run this
! daily from cron:
! mknmz -f /home/user/Mail/.namazu/mknmzrc -O /home/user/Mail/.namazu \\
! /home/user/Mail
! FOLDER-PATH is the directory in which SEARCH-REGEXP is used to search."
(let ((namazu-index-directory
(format "%s%s" mh-user-path mh-namazu-directory)))
(unless (file-exists-p namazu-index-directory)
--- 1549,1577 ----
(defun mh-namazu-execute-search (folder-path search-regexp)
"Execute namazu and read the results.
! In the examples below, replace \"/home/user/Mail\" with the path to your MH
directory.
! First create the directory \"/home/user/Mail/.namazu\". Then create the file
! \"/home/user/Mail/.namazu/mknmzrc\" with the following contents:
! package conf; # Don't remove this line!
! $ADDRESS = 'address@hidden';
! $ALLOW_FILE = \"[0-9]*\";
! $EXCLUDE_PATH = \"^/home/user/Mail/(mhe-index|spam)\";
!
! This configuration does not index the folders that hold the results of your
! searches in \"+mhe-index\" since they tend to be ephemeral and the original
! messages are indexed anyway.
! Use the following command line to generate the namazu index. Run this daily
! from cron:
! mknmz -f /home/user/Mail/.namazu/mknmzrc -O /home/user/Mail/.namazu \\
! /home/user/Mail
! In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP is used to
! search."
(let ((namazu-index-directory
(format "%s%s" mh-user-path mh-namazu-directory)))
(unless (file-exists-p namazu-index-directory)