aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Wohler2006-01-14 21:17:37 +0000
committerBill Wohler2006-01-14 21:17:37 +0000
commita4d7cec3dc548a306f695e34ba94f709da765d46 (patch)
treefe21e692c6286fcc1b1924312216794ae5daec99
parent852ae42ac7d865d4457b32a9da11178d788a83f1 (diff)
downloademacs-a4d7cec3dc548a306f695e34ba94f709da765d46.tar.gz
emacs-a4d7cec3dc548a306f695e34ba94f709da765d46.zip
* mh-customize.el (mh-index): Rename group to mh-search and sort group
definition and options accordingly. (mh-index-program): Rename to mh-search-program. (mh-kill-folder-suppress-prompt-hooks): Rename mh-index-p to mh-search-p. (mh-search-mode-hook): Change group from mh-index to mh-search. (mh-index-folder): Rename to mh-search-folder. Change group from mh-index to mh-search. * mh-e.el (mh-folder-font-lock-keywords): Rename mh-index-folder to mh-search-folder. * mh-search.el (mh-indexer) Rename to mh-searcher. The commands pick and grep are searchers too but aren't indexed. (mh-index-execute-search-function): Rename to mh-search-function. (mh-index-next-result-function): Rename to mh-search-next-result-function. (mh-index-regexp-builder): Rename to mh-search-regexp-builder. (mh-search): Since redo-search-flag defaults to nil and is of lesser importance, make it an optional argument and place it after the folder and search-regexp arguments. Sync docstring with manual. (mh-search-mode-map): Autoload so that keys are shown in help even before mh-search is loaded. (mh-search-mode): Sync docstring with manual. (mh-index-do-search): Rename argument indexer to searcher. Sync docstring with manual. (mh-pick-do-search): Sync docstring with manual. (mh-index-p): Rename to mh-search-p. (mh-indexer-choices): Rename to mh-search-choices. (mh-index-choose): Rename to mh-search-choose. Rename argument indexer to searcher. (mh-swish++-execute-search, mh-swish-execute-search) (mh-mairix-execute-search, mh-namazu-execute-search): Drop "and read the results" from docstring since these functions don't. (mh-pick-execute-search, mh-grep-execute-search): Sync docstring with manual. (mh-index-generate-pretty-name): Prune -search from string so that folder names for pick searches are the same as those of other searches.
-rw-r--r--lisp/mh-e/ChangeLog43
-rw-r--r--lisp/mh-e/mh-customize.el72
-rw-r--r--lisp/mh-e/mh-e.el2
-rw-r--r--lisp/mh-e/mh-search.el256
4 files changed, 212 insertions, 161 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index 74b38dac688..f99269fb555 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -1,3 +1,46 @@
12006-01-14 Bill Wohler <wohler@newt.com>
2
3 * mh-customize.el (mh-index): Rename group to mh-search and sort
4 group definition and options accordingly.
5 (mh-index-program): Rename to mh-search-program.
6 (mh-kill-folder-suppress-prompt-hooks): Rename mh-index-p to
7 mh-search-p.
8 (mh-search-mode-hook): Change group from mh-index to mh-search.
9 (mh-index-folder): Rename to mh-search-folder. Change group from
10 mh-index to mh-search.
11
12 * mh-e.el (mh-folder-font-lock-keywords): Rename mh-index-folder
13 to mh-search-folder.
14
15 * mh-search.el (mh-indexer) Rename to mh-searcher. The commands
16 pick and grep are searchers too but aren't indexed.
17 (mh-index-execute-search-function): Rename to mh-search-function.
18 (mh-index-next-result-function): Rename to
19 mh-search-next-result-function.
20 (mh-index-regexp-builder): Rename to mh-search-regexp-builder.
21 (mh-search): Since redo-search-flag defaults to nil and is of
22 lesser importance, make it an optional argument and place it after
23 the folder and search-regexp arguments. Sync docstring with
24 manual.
25 (mh-search-mode-map): Autoload so that keys are shown in help even
26 before mh-search is loaded.
27 (mh-search-mode): Sync docstring with manual.
28 (mh-index-do-search): Rename argument indexer to searcher. Sync
29 docstring with manual.
30 (mh-pick-do-search): Sync docstring with manual.
31 (mh-index-p): Rename to mh-search-p.
32 (mh-indexer-choices): Rename to mh-search-choices.
33 (mh-index-choose): Rename to mh-search-choose. Rename argument
34 indexer to searcher.
35 (mh-swish++-execute-search, mh-swish-execute-search)
36 (mh-mairix-execute-search, mh-namazu-execute-search): Drop "and
37 read the results" from docstring since these functions don't.
38 (mh-pick-execute-search, mh-grep-execute-search): Sync docstring
39 with manual.
40 (mh-index-generate-pretty-name): Prune -search from string so that
41 folder names for pick searches are the same as those of other
42 searches.
43
12006-01-13 Bill Wohler <wohler@newt.com> 442006-01-13 Bill Wohler <wohler@newt.com>
2 45
3 * mh-acros.el (require): Added Satyaki's comment regarding what 46 * mh-acros.el (require): Added Satyaki's comment regarding what
diff --git a/lisp/mh-e/mh-customize.el b/lisp/mh-e/mh-customize.el
index 71a62eb1de9..17df6397938 100644
--- a/lisp/mh-e/mh-customize.el
+++ b/lisp/mh-e/mh-customize.el
@@ -134,12 +134,6 @@ and GNU mailutils."
134 :link '(custom-manual "(mh-e)Incorporating Mail") 134 :link '(custom-manual "(mh-e)Incorporating Mail")
135 :group 'mh-e) 135 :group 'mh-e)
136 136
137(defgroup mh-index nil
138 "Searching."
139 :link '(custom-manual "(mh-e)Searching")
140 :prefix "mh-index-"
141 :group 'mh-e)
142
143(defgroup mh-junk nil 137(defgroup mh-junk nil
144 "Dealing with junk mail." 138 "Dealing with junk mail."
145 :link '(custom-manual "(mh-e)Junk") 139 :link '(custom-manual "(mh-e)Junk")
@@ -164,6 +158,12 @@ and GNU mailutils."
164 :prefix "mh-" 158 :prefix "mh-"
165 :group 'mh-e) 159 :group 'mh-e)
166 160
161(defgroup mh-search nil
162 "Searching."
163 :link '(custom-manual "(mh-e)Searching")
164 :prefix "mh-search-"
165 :group 'mh-e)
166
167(defgroup mh-sending-mail nil 167(defgroup mh-sending-mail nil
168 "Sending mail." 168 "Sending mail."
169 :prefix "mh-" 169 :prefix "mh-"
@@ -713,30 +713,6 @@ using the \"gnudoit\" command in the \"gnuserv\" package as follows:
713 713
714 714
715 715
716;;; Searching (:group 'mh-index)
717
718(defcustom mh-index-program nil
719 "Indexing program that MH-E shall use.
720
721The default setting of this option is \"Auto-detect\" which means
722that MH-E will automatically choose one of swish++, swish-e,
723mairix, namazu, pick and grep in that order. If, for example, you
724have both swish++ and mairix installed and you want to use
725mairix, then you can set this option to \"mairix\".
726
727More information about setting up an indexing program to use with
728MH-E can be found in the documentation of `mh-search'."
729 :type '(choice (const :tag "Auto-detect" nil)
730 (const :tag "swish++" swish++)
731 (const :tag "swish-e" swish)
732 (const :tag "mairix" mairix)
733 (const :tag "namazu" namazu)
734 (const :tag "pick" pick)
735 (const :tag "grep" grep))
736 :group 'mh-index)
737
738
739
740;;; Dealing with Junk Mail (:group 'mh-junk) 716;;; Dealing with Junk Mail (:group 'mh-junk)
741 717
742;; Spam fighting program chosen 718;; Spam fighting program chosen
@@ -1114,6 +1090,30 @@ directory. You may link another program to `scan' (see
1114 1090
1115 1091
1116 1092
1093;;; Searching (:group 'mh-search)
1094
1095(defcustom mh-search-program nil
1096 "Search program that MH-E shall use.
1097
1098The default setting of this option is \"Auto-detect\" which means
1099that MH-E will automatically choose one of swish++, swish-e,
1100mairix, namazu, pick and grep in that order. If, for example, you
1101have both swish++ and mairix installed and you want to use
1102mairix, then you can set this option to \"mairix\".
1103
1104More information about setting up an indexing program to use with
1105MH-E can be found in the documentation of `mh-search'."
1106 :type '(choice (const :tag "Auto-detect" nil)
1107 (const :tag "swish++" swish++)
1108 (const :tag "swish-e" swish)
1109 (const :tag "mairix" mairix)
1110 (const :tag "namazu" namazu)
1111 (const :tag "pick" pick)
1112 (const :tag "grep" grep))
1113 :group 'mh-search)
1114
1115
1116
1117;;; Sending Mail (:group 'mh-sending-mail) 1117;;; Sending Mail (:group 'mh-sending-mail)
1118 1118
1119(defcustom mh-compose-forward-as-mime-flag t 1119(defcustom mh-compose-forward-as-mime-flag t
@@ -2400,15 +2400,15 @@ function used to insert the signature with
2400 :group 'mh-hooks 2400 :group 'mh-hooks
2401 :group 'mh-letter) 2401 :group 'mh-letter)
2402 2402
2403(defcustom mh-kill-folder-suppress-prompt-hooks '(mh-index-p) 2403(defcustom mh-kill-folder-suppress-prompt-hooks '(mh-search-p)
2404 "Abnormal hook run at the beginning of \\<mh-folder-mode-map>\\[mh-kill-folder]. 2404 "Abnormal hook run at the beginning of \\<mh-folder-mode-map>\\[mh-kill-folder].
2405 2405
2406The hook functions are called with no arguments and should return 2406The hook functions are called with no arguments and should return
2407a non-nil value to suppress the normal prompt when you remove a 2407a non-nil value to suppress the normal prompt when you remove a
2408folder. This is useful for folders that are easily regenerated. 2408folder. This is useful for folders that are easily regenerated.
2409 2409
2410The default value of `mh-index-p' suppresses the prompt on 2410The default value of `mh-search-p' suppresses the prompt on
2411folders generated by an index search. 2411folders generated by searching.
2412 2412
2413WARNING: Use this hook with care. If there is a bug in your hook 2413WARNING: Use this hook with care. If there is a bug in your hook
2414which returns t on \"+inbox\" and you hit \\[mh-kill-folder] by 2414which returns t on \"+inbox\" and you hit \\[mh-kill-folder] by
@@ -2444,7 +2444,7 @@ This can be done with this hook which is called when
2444\\[mh-search] is run on a new pattern." 2444\\[mh-search] is run on a new pattern."
2445 :type 'hook 2445 :type 'hook
2446 :group 'mh-hooks 2446 :group 'mh-hooks
2447 :group 'mh-index) 2447 :group 'mh-search)
2448 2448
2449(defcustom mh-quit-hook nil 2449(defcustom mh-quit-hook nil
2450 "Hook run by \\<mh-folder-mode-map>\\[mh-quit] after quitting MH-E. 2450 "Hook run by \\<mh-folder-mode-map>\\[mh-quit] after quitting MH-E.
@@ -2629,7 +2629,7 @@ format `mh-scan-format-nmh' and the regular expression
2629 :group 'mh-faces 2629 :group 'mh-faces
2630 :group 'mh-folder) 2630 :group 'mh-folder)
2631 2631
2632(defface mh-index-folder 2632(defface mh-search-folder
2633 '((((class color) (background light)) 2633 '((((class color) (background light))
2634 (:foreground "dark green" :bold t)) 2634 (:foreground "dark green" :bold t))
2635 (((class color) (background dark)) 2635 (((class color) (background dark))
@@ -2638,7 +2638,7 @@ format `mh-scan-format-nmh' and the regular expression
2638 (:bold t))) 2638 (:bold t)))
2639 "Folder heading face in MH-Folder buffers created by searches." 2639 "Folder heading face in MH-Folder buffers created by searches."
2640 :group 'mh-faces 2640 :group 'mh-faces
2641 :group 'mh-index) 2641 :group 'mh-search)
2642 2642
2643(defface mh-letter-header-field 2643(defface mh-letter-header-field
2644 '((((class color) (background light)) 2644 '((((class color) (background light))
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 551aa21d5cd..42697ed6c8a 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -331,7 +331,7 @@ highlighted with the face `mh-folder-sent-to-me-sender'.")
331 (list 331 (list
332 ;; Folders when displaying index buffer 332 ;; Folders when displaying index buffer
333 (list "^\\+.*" 333 (list "^\\+.*"
334 '(0 'mh-index-folder)) 334 '(0 'mh-search-folder))
335 ;; Marked for deletion 335 ;; Marked for deletion
336 (list (concat mh-scan-deleted-msg-regexp ".*") 336 (list (concat mh-scan-deleted-msg-regexp ".*")
337 '(0 'mh-folder-deleted)) 337 '(0 'mh-folder-deleted))
diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el
index 8eb2a370e3e..e98e376b87b 100644
--- a/lisp/mh-e/mh-search.el
+++ b/lisp/mh-e/mh-search.el
@@ -1,4 +1,4 @@
1;;; mh-search -- MH-E search 1;;; mh-search --- MH-E search
2 2
3;; Copyright (C) 1993, 1995, 3;; Copyright (C) 1993, 1995,
4;; 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 4;; 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
@@ -38,7 +38,7 @@
38;; (2) To use this package, you first have to build an index. Please 38;; (2) To use this package, you first have to build an index. Please
39;; read the documentation for `mh-search' to get started. That 39;; read the documentation for `mh-search' to get started. That
40;; documentation will direct you to the specific instructions for 40;; documentation will direct you to the specific instructions for
41;; your particular indexer. 41;; your particular searcher.
42 42
43;;; Change Log: 43;;; Change Log:
44 44
@@ -51,18 +51,18 @@
51(require 'mh-buffers) 51(require 'mh-buffers)
52(require 'mh-e) 52(require 'mh-e)
53 53
54(defvar mh-indexer nil 54(defvar mh-searcher nil
55 "Cached value of chosen index program.") 55 "Cached value of chosen search program.")
56 56
57(defvar mh-index-execute-search-function nil 57(defvar mh-search-function nil
58 "Function which executes the search program.") 58 "Function which executes the search program.")
59 59
60(defvar mh-index-next-result-function nil 60(defvar mh-search-next-result-function nil
61 "Function to parse the next line of output. 61 "Function to parse the next line of output.
62Expected to return a list of three strings: name of the folder, 62Expected to return a list of three strings: name of the folder,
63message number, and optionally the match.") 63message number, and optionally the match.")
64 64
65(defvar mh-index-regexp-builder nil 65(defvar mh-search-regexp-builder nil
66 "Function used to construct search regexp.") 66 "Function used to construct search regexp.")
67 67
68(defvar mh-index-folder "+mhe-index" 68(defvar mh-index-folder "+mhe-index"
@@ -80,23 +80,28 @@ message number, and optionally the match.")
80;;; MH-Search mode 80;;; MH-Search mode
81 81
82;;;###mh-autoload 82;;;###mh-autoload
83(defun* mh-search (redo-search-flag folder search-regexp 83(defun* mh-search (folder search-regexp
84 &optional window-config) 84 &optional redo-search-flag window-config)
85 "Search your MH mail. 85 "Search your MH mail.
86 86
87With this command, you can search for messages to or from a 87This command helps you find messages in your entire corpus of
88particular person or about a particular subject. In fact, you can 88mail. You can search for messages to or from a particular person
89also search for messages containing selected strings in any 89or about a particular subject. In fact, you can also search for
90arbitrary header field or any string found within the messages. 90messages containing selected strings in any arbitrary header
91field or any string found within the messages.
91 92
92Use a prefix argument REDO-SEARCH-FLAG to repeat the last search. 93Out of the box, MH-E uses \"pick\" to find messages. With a
94little extra effort, you can set an indexing program which
95rewards you with extremely quick results. The drawback is that
96sometimes the index does not contain the words you're looking
97for. You can still use \"pick\" in these situations.
93 98
94You are prompted for the FOLDER to search. This can be \"all\" to 99You are prompted for the FOLDER to search. This can be \"all\" to
95search all folders. For most search methods, the search works 100search all folders. Note that the search works recursively on the
96recursively on the listed folder. 101listed folder.
97 102
98Next, an MH-Search buffer appears where you can enter search 103Next, an MH-Search buffer appears where you can enter search
99criteria. 104criteria SEARCH-REGEXP.
100 105
101 From: 106 From:
102 To: 107 To:
@@ -111,17 +116,12 @@ field yourself. If the string you're looking for could be
111anywhere in a message, then place the string underneath the row 116anywhere in a message, then place the string underneath the row
112of dashes. 117of dashes.
113 118
114It is all right to specify several search criteria. What happens
115then is that a logical _and_ of the various fields is performed.
116If you prefer a logical _or_ operation, run \\[mh-search]
117multiple times.
118
119As an example, let's say that we want to find messages from 119As an example, let's say that we want to find messages from
120Ginnean about horseback riding in the Kosciusko National 120Ginnean about horseback riding in the Kosciusko National
121Park (Australia) during January, 1994. Normally we would start 121Park (Australia) during January, 1994. Normally we would start
122with a broad search and narrow it down if necessary to produce a 122with a broad search and narrow it down if necessary to produce a
123manageable amount of data, but we'll cut to the chase and create 123manageable amount of data, but we'll cut to the chase and create
124a fairly restrictive set of criteria as follows: 124a fairly restrictive set of criteria as follows:\\<mh-search-mode-map>
125 125
126 From: ginnean 126 From: ginnean
127 To: 127 To:
@@ -133,13 +133,12 @@ a fairly restrictive set of criteria as follows:
133 kosciusko 133 kosciusko
134 134
135As with MH-Letter mode, MH-Search provides commands like 135As with MH-Letter mode, MH-Search provides commands like
136\\<mh-search-mode-map>\\[mh-to-field] to help you fill in the 136\\[mh-to-field] to help you fill in the blanks.\\<mh-folder-mode-map>
137blanks.
138 137
139If you find that you do the same thing over and over when editing 138If you find that you do the same thing over and over when editing
140the search template, you may wish to bind some shortcuts to keys. 139the search template, you may wish to bind some shortcuts to keys.
141This can be done with the variable `mh-search-mode-hook', which is 140This can be done with the variable `mh-search-mode-hook', which is
142called when \\[mh-search] is run on a new pattern. 141called when \\[mh-search] is run on a new pattern.\\<mh-search-mode-map>
143 142
144To perform the search, type \\[mh-index-do-search]. 143To perform the search, type \\[mh-index-do-search].
145 144
@@ -155,7 +154,7 @@ folders; each set of messages from a given folder has a heading
155with the folder name.\\<mh-folder-mode-map> 154with the folder name.\\<mh-folder-mode-map>
156 155
157The appearance of the heading can be modified by customizing the 156The appearance of the heading can be modified by customizing the
158face `mh-index-folder'. You can jump back and forth between the 157face `mh-search-folder'. You can jump back and forth between the
159headings using the commands \\[mh-index-next-folder] and 158headings using the commands \\[mh-index-next-folder] and
160\\[mh-index-previous-folder]. 159\\[mh-index-previous-folder].
161 160
@@ -169,37 +168,33 @@ find the actual message number of an interesting message, or to
169view surrounding messages with the command \\[mh-rescan-folder]. 168view surrounding messages with the command \\[mh-rescan-folder].
170 169
171Because this folder is temporary, you'll probably get in the 170Because this folder is temporary, you'll probably get in the
172habit of killing it when you're done with 171habit of killing it when you're done with \\[mh-kill-folder].
173\\[mh-kill-folder]. 172
173You can regenerate the results by running this command with a
174prefix argument REDO-SEARCH-FLAG.
175
176Note: This command uses an \"X-MHE-Checksum:\" header field to
177cache the MD5 checksum of a message. This means that if an
178incoming message already contains an \"X-MHE-Checksum:\" field,
179that message might not be found by this command. The following
180\"procmail\" recipe avoids this problem by renaming the existing
181header field:
182
183 :0 wf
184 | formail -R \"X-MHE-Checksum\" \"X-Old-MHE-Checksum\"
174 185
175SEARCH METHODS 186Configuring Indexed Searches
176 187
177The command \\[mh-search] runs the command defined by the option 188The command \\[mh-search] runs the command defined by the option
178`mh-index-program'. The default value is \"Auto-detect\" which 189`mh-search-program'. The default value is \"Auto-detect\" which
179means that MH-E will automatically choose one of \"swish++\", 190means that MH-E will automatically choose one of \"swish++\",
180\"swish-e\", \"mairix\", \"namazu\", \"pick\" and \"grep\" in 191\"swish-e\", \"mairix\", \"namazu\", \"pick\" and \"grep\" in
181that order. If, for example, you have both \"swish++\" and 192that order. If, for example, you have both \"swish++\" and
182\"mairix\" installed and you want to use \"mairix\", then you can 193\"mairix\" installed and you want to use \"mairix\", then you can
183set this option to \"mairix\". 194set this option to \"mairix\".
184 195
185 *NOTE*
186
187 The \"pick\" and \"grep\" commands do not perform a
188 recursive search on the given folder.
189
190This command uses an \"X-MHE-Checksum:\" header field to cache
191the MD5 checksum of a message. This means that if an incoming
192message already contains an \"X-MHE-Checksum:\" field, that
193message might not be found by this command. The following
194\"procmail\" recipe avoids this problem by renaming the existing
195header field:
196
197 :0 wf
198 | formail -R \"X-MHE-Checksum\" \"X-Old-MHE-Checksum\"
199
200The documentation for the following commands describe how to set 196The documentation for the following commands describe how to set
201up the various indexing programs to use with MH-E. The \"pick\" 197up the various indexing programs to use with MH-E.
202and \"grep\" commands do not require additional configuration.
203 198
204 - `mh-swish++-execute-search' 199 - `mh-swish++-execute-search'
205 - `mh-swish-execute-search' 200 - `mh-swish-execute-search'
@@ -208,31 +203,30 @@ and \"grep\" commands do not require additional configuration.
208 - `mh-pick-execute-search' 203 - `mh-pick-execute-search'
209 - `mh-grep-execute-search' 204 - `mh-grep-execute-search'
210 205
211In a program, the folder is searched with SEARCH-REGEXP. If 206In a program, if FOLDER is \"+\" or nil, then mail in all folders
212FOLDER is \"+\" then mail in all folders are searched. Optional 207are searched. Optional argument WINDOW-CONFIG stores the window
213argument WINDOW-CONFIG stores the window configuration that will 208configuration that will be restored after the user quits the
214be restored after the user quits the folder containing the index 209folder containing the index search results."
215search results."
216 (interactive 210 (interactive
217 (list current-prefix-arg 211 (list (progn
218 (progn
219 (mh-find-path) 212 (mh-find-path)
220 ;; Yes, we do want to call mh-index-choose every time in case the 213 ;; Yes, we do want to call mh-search-choose every time in case the
221 ;; user has switched the indexer manually. 214 ;; user has switched the searcher manually.
222 (unless (mh-index-choose (and current-prefix-arg 215 (unless (mh-search-choose (and current-prefix-arg
223 mh-index-previous-search 216 mh-index-previous-search
224 (cadr mh-index-previous-search))) 217 (cadr mh-index-previous-search)))
225 (error "No indexing program found")) 218 (error "No search program found"))
226 (or (and current-prefix-arg mh-index-sequence-search-flag) 219 (or (and current-prefix-arg mh-index-sequence-search-flag)
227 (and current-prefix-arg (car mh-index-previous-search)) 220 (and current-prefix-arg (car mh-index-previous-search))
228 (mh-prompt-for-folder "Search" "+" nil "all" t))) 221 (mh-prompt-for-folder "Search" "+" nil "all" t)))
229 (or (and current-prefix-arg (caddr mh-index-previous-search)) 222 (or (and current-prefix-arg (caddr mh-index-previous-search))
230 mh-index-regexp-builder 223 mh-search-regexp-builder
231 (read-string (format "%s regexp: " 224 (read-string (format "%s regexp: "
232 (upcase-initials (symbol-name mh-indexer))))) 225 (upcase-initials (symbol-name mh-searcher)))))
226 current-prefix-arg
233 (if (and (not (and current-prefix-arg 227 (if (and (not (and current-prefix-arg
234 (caddr mh-index-previous-search))) 228 (caddr mh-index-previous-search)))
235 mh-index-regexp-builder) 229 mh-search-regexp-builder)
236 (current-window-configuration) 230 (current-window-configuration)
237 nil))) 231 nil)))
238 ;; Redoing a sequence search? 232 ;; Redoing a sequence search?
@@ -265,13 +259,13 @@ search results."
265 (folder-results-map (make-hash-table :test #'equal)) 259 (folder-results-map (make-hash-table :test #'equal))
266 (origin-map (make-hash-table :test #'equal))) 260 (origin-map (make-hash-table :test #'equal)))
267 ;; Run search program... 261 ;; Run search program...
268 (message "Executing %s... " mh-indexer) 262 (message "Executing %s... " mh-searcher)
269 (funcall mh-index-execute-search-function folder-path search-regexp) 263 (funcall mh-search-function folder-path search-regexp)
270 264
271 ;; Parse indexer output. 265 ;; Parse searcher output.
272 (message "Processing %s output... " mh-indexer) 266 (message "Processing %s output... " mh-searcher)
273 (goto-char (point-min)) 267 (goto-char (point-min))
274 (loop for next-result = (funcall mh-index-next-result-function) 268 (loop for next-result = (funcall mh-search-next-result-function)
275 while next-result 269 while next-result
276 do (unless (eq next-result 'error) 270 do (unless (eq next-result 'error)
277 (unless (gethash (car next-result) folder-results-map) 271 (unless (gethash (car next-result) folder-results-map)
@@ -314,13 +308,13 @@ search results."
314 ;; Maintain history. 308 ;; Maintain history.
315 (when (or (and redo-search-flag previous-search) window-config) 309 (when (or (and redo-search-flag previous-search) window-config)
316 (setq mh-previous-window-config old-window-config)) 310 (setq mh-previous-window-config old-window-config))
317 (setq mh-index-previous-search (list folder mh-indexer search-regexp)) 311 (setq mh-index-previous-search (list folder mh-searcher search-regexp))
318 312
319 ;; Write out data to disk. 313 ;; Write out data to disk.
320 (unless mh-flists-called-flag (mh-index-write-data)) 314 (unless mh-flists-called-flag (mh-index-write-data))
321 315
322 (message "%s found %s matches in %s folders" 316 (message "%s found %s matches in %s folders"
323 (upcase-initials (symbol-name mh-indexer)) 317 (upcase-initials (symbol-name mh-searcher))
324 (loop for msg-hash being hash-values of mh-index-data 318 (loop for msg-hash being hash-values of mh-index-data
325 sum (hash-table-count msg-hash)) 319 sum (hash-table-count msg-hash))
326 (loop for msg-hash being hash-values of mh-index-data 320 (loop for msg-hash being hash-values of mh-index-data
@@ -367,9 +361,11 @@ configuration and is used when the search folder is dismissed."
367 (add-text-properties (point) (1- (line-end-position)) '(read-only t)) 361 (add-text-properties (point) (1- (line-end-position)) '(read-only t))
368 (goto-char (point-max))) 362 (goto-char (point-max)))
369 363
364;;;###mh-autoload
370(defvar mh-search-mode-map (make-sparse-keymap) 365(defvar mh-search-mode-map (make-sparse-keymap)
371 "Keymap for searching folder.") 366 "Keymap for searching folder.")
372 367
368;;;###mh-autoload
373;; If this changes, modify mh-search-mode-help-messages accordingly, below. 369;; If this changes, modify mh-search-mode-help-messages accordingly, below.
374(gnus-define-keys mh-search-mode-map 370(gnus-define-keys mh-search-mode-map
375 "\C-c?" mh-help 371 "\C-c?" mh-help
@@ -420,12 +416,18 @@ as well.")
420(define-derived-mode mh-search-mode fundamental-mode "MH-Search" 416(define-derived-mode mh-search-mode fundamental-mode "MH-Search"
421 "Mode for creating search templates in MH-E.\\<mh-search-mode-map> 417 "Mode for creating search templates in MH-E.\\<mh-search-mode-map>
422 418
423After each field name, enter the pattern to search for. If a field's 419Edit this template by entering your search criteria in an
424value does not matter for the search, leave it empty. To search the 420appropriate header field that is already there, or create a new
425entire message, supply the pattern in the \"body\" of the template. 421field yourself. If the string you're looking for could be
426Each non-empty field must be matched for a message to be selected. To 422anywhere in a message, then place the string underneath the row
427effect a logical \"or\", use \\[mh-search-folder] multiple times. When 423of dashes.
428you have finished, type \\[mh-pick-do-search] to do the search. 424
425To perform the search, type \\[mh-index-do-search].
426
427Sometimes you're searching for text that is either not indexed,
428or hasn't been indexed yet. In this case you can override the
429default method with the pick method by running the command
430\\[mh-pick-do-search].
429 431
430The hook `mh-search-mode-hook' is called upon entry to this mode. 432The hook `mh-search-mode-hook' is called upon entry to this mode.
431 433
@@ -436,21 +438,21 @@ The hook `mh-search-mode-hook' is called upon entry to this mode.
436 (setq mh-help-messages mh-search-mode-help-messages)) 438 (setq mh-help-messages mh-search-mode-help-messages))
437 439
438;;;###mh-autoload 440;;;###mh-autoload
439(defun mh-index-do-search (&optional indexer) 441(defun mh-index-do-search (&optional searcher)
440 "Find messages that match the qualifications in the current pattern buffer. 442 "Find messages using `mh-search-program'.
441If optional argument INDEXER is present, use it instead of 443If optional argument SEARCHER is present, use it instead of
442`mh-index-program'." 444`mh-search-program'."
443 (interactive) 445 (interactive)
444 (unless (mh-index-choose indexer) (error "No indexing program found")) 446 (unless (mh-search-choose searcher) (error "No search program found"))
445 (let* ((regexp-list (mh-pick-parse-search-buffer)) 447 (let* ((regexp-list (mh-pick-parse-search-buffer))
446 (pattern (funcall mh-index-regexp-builder regexp-list))) 448 (pattern (funcall mh-search-regexp-builder regexp-list)))
447 (if pattern 449 (if pattern
448 (mh-search nil mh-current-folder pattern mh-previous-window-config) 450 (mh-search mh-current-folder pattern nil mh-previous-window-config)
449 (error "No search terms")))) 451 (error "No search terms"))))
450 452
451;;;###mh-autoload 453;;;###mh-autoload
452(defun mh-pick-do-search () 454(defun mh-pick-do-search ()
453 "Find messages that match the qualifications in the current pattern buffer. 455 "Find messages using \"pick\".
454 456
455Uses the pick method described in `mh-pick-execute-search'." 457Uses the pick method described in `mh-pick-execute-search'."
456 (interactive) 458 (interactive)
@@ -642,11 +644,11 @@ search all folders."
642 (let* ((mh-flists-search-folders folders) 644 (let* ((mh-flists-search-folders folders)
643 (mh-flists-sequence sequence) 645 (mh-flists-sequence sequence)
644 (mh-flists-called-flag t) 646 (mh-flists-called-flag t)
645 (mh-indexer 'flists) 647 (mh-searcher 'flists)
646 (mh-index-execute-search-function 'mh-flists-execute) 648 (mh-search-function 'mh-flists-execute)
647 (mh-index-next-result-function 'mh-mairix-next-result) 649 (mh-search-next-result-function 'mh-mairix-next-result)
648 (mh-mairix-folder mh-user-path) 650 (mh-mairix-folder mh-user-path)
649 (mh-index-regexp-builder nil) 651 (mh-search-regexp-builder nil)
650 (new-folder (format "%s/%s/%s" mh-index-folder 652 (new-folder (format "%s/%s/%s" mh-index-folder
651 mh-flists-results-folder sequence)) 653 mh-flists-results-folder sequence))
652 (window-config (if (equal new-folder mh-current-folder) 654 (window-config (if (equal new-folder mh-current-folder)
@@ -658,16 +660,16 @@ search all folders."
658 ;; The destination folder is being visited. Trick `mh-search' 660 ;; The destination folder is being visited. Trick `mh-search'
659 ;; into thinking that the folder resulted from a previous search. 661 ;; into thinking that the folder resulted from a previous search.
660 (set-buffer new-folder) 662 (set-buffer new-folder)
661 (setq mh-index-previous-search (list folders mh-indexer sequence)) 663 (setq mh-index-previous-search (list folders mh-searcher sequence))
662 (setq redo-flag t)) 664 (setq redo-flag t))
663 ((mh-folder-exists-p new-folder) 665 ((mh-folder-exists-p new-folder)
664 ;; Folder exists but we don't have it open. That means they are 666 ;; Folder exists but we don't have it open. That means they are
665 ;; stale results from a old flists search. Clear it out. 667 ;; stale results from a old flists search. Clear it out.
666 (mh-exec-cmd-quiet nil "rmf" new-folder))) 668 (mh-exec-cmd-quiet nil "rmf" new-folder)))
667 (setq message (mh-search redo-flag "+" mh-flists-results-folder 669 (setq message (mh-search "+" mh-flists-results-folder
668 window-config) 670 redo-flag window-config)
669 mh-index-sequence-search-flag t 671 mh-index-sequence-search-flag t
670 mh-index-previous-search (list folders mh-indexer sequence)) 672 mh-index-previous-search (list folders mh-searcher sequence))
671 (mh-index-write-data) 673 (mh-index-write-data)
672 (when (stringp message) (message "%s" message)))) 674 (when (stringp message) (message "%s" message))))
673 675
@@ -831,8 +833,8 @@ group of results."
831 when (mh-msg-exists-p x folder) collect x))))) 833 when (mh-msg-exists-p x folder) collect x)))))
832 834
833;;;###mh-autoload 835;;;###mh-autoload
834(defun mh-index-p () 836(defun mh-search-p ()
835 "Non-nil means that this folder was generated by an index search." 837 "Non-nil means that this folder was generated by searching."
836 mh-index-data) 838 mh-index-data)
837 839
838;;;###mh-autoload 840;;;###mh-autoload
@@ -881,8 +883,8 @@ user has marked in the index buffer."
881 883
882;;; Indexing functions 884;;; Indexing functions
883 885
884;; Support different indexing programs 886;; Support different search programs
885(defvar mh-indexer-choices 887(defvar mh-search-choices
886 '((swish++ 888 '((swish++
887 mh-swish++-binary mh-swish++-execute-search mh-swish++-next-result 889 mh-swish++-binary mh-swish++-execute-search mh-swish++-next-result
888 mh-swish++-regexp-builder) 890 mh-swish++-regexp-builder)
@@ -898,32 +900,32 @@ user has marked in the index buffer."
898 mh-pick-regexp-builder) 900 mh-pick-regexp-builder)
899 (grep 901 (grep
900 mh-grep-binary mh-grep-execute-search mh-grep-next-result nil)) 902 mh-grep-binary mh-grep-execute-search mh-grep-next-result nil))
901 "List of possible indexer choices.") 903 "List of possible searcher choices.")
902 904
903(defun mh-index-choose (&optional indexer) 905(defun mh-search-choose (&optional searcher)
904 "Choose an indexing function. 906 "Choose a searching function.
905The side-effects of this function are that the variables 907The side-effects of this function are that the variables
906`mh-indexer', `mh-index-execute-search-function', and 908`mh-searcher', `mh-search-function', and
907`mh-index-next-result-function' are set according to the first 909`mh-search-next-result-function' are set according to the first
908indexer in `mh-indexer-choices' present on the system. 910searcher in `mh-search-choices' present on the system. If
909If optional argument INDEXER is present, use it instead of 911optional argument SEARCHER is present, use it instead of
910`mh-index-program'." 912`mh-search-program'."
911 (block nil 913 (block nil
912 (let ((program-alist (cond (indexer 914 (let ((program-alist (cond (searcher
913 (list (assoc indexer mh-indexer-choices))) 915 (list (assoc searcher mh-search-choices)))
914 (mh-index-program 916 (mh-search-program
915 (list 917 (list
916 (assoc mh-index-program mh-indexer-choices))) 918 (assoc mh-search-program mh-search-choices)))
917 (t mh-indexer-choices)))) 919 (t mh-search-choices))))
918 (while program-alist 920 (while program-alist
919 (let* ((current (pop program-alist)) 921 (let* ((current (pop program-alist))
920 (executable (symbol-value (cadr current)))) 922 (executable (symbol-value (cadr current))))
921 (when executable 923 (when executable
922 (setq mh-indexer (car current)) 924 (setq mh-searcher (car current))
923 (setq mh-index-execute-search-function (nth 2 current)) 925 (setq mh-search-function (nth 2 current))
924 (setq mh-index-next-result-function (nth 3 current)) 926 (setq mh-search-next-result-function (nth 3 current))
925 (setq mh-index-regexp-builder (nth 4 current)) 927 (setq mh-search-regexp-builder (nth 4 current))
926 (return mh-indexer)))) 928 (return mh-searcher))))
927 nil))) 929 nil)))
928 930
929;;; Swish++ interface 931;;; Swish++ interface
@@ -935,7 +937,7 @@ If optional argument INDEXER is present, use it instead of
935 937
936;;;###mh-autoload 938;;;###mh-autoload
937(defun mh-swish++-execute-search (folder-path search-regexp) 939(defun mh-swish++-execute-search (folder-path search-regexp)
938 "Execute swish++ and read the results. 940 "Execute swish++.
939 941
940In the examples below, replace \"/home/user/Mail\" with the path to 942In the examples below, replace \"/home/user/Mail\" with the path to
941your MH directory. 943your MH directory.
@@ -1015,7 +1017,7 @@ REGEXP-LIST is an alist of fields and values."
1015 1017
1016;;;###mh-autoload 1018;;;###mh-autoload
1017(defun mh-swish-execute-search (folder-path search-regexp) 1019(defun mh-swish-execute-search (folder-path search-regexp)
1018 "Execute swish-e and read the results. 1020 "Execute swish-e.
1019 1021
1020In the examples below, replace \"/home/user/Mail\" with the path 1022In the examples below, replace \"/home/user/Mail\" with the path
1021to your MH directory. 1023to your MH directory.
@@ -1116,7 +1118,7 @@ is used to search."
1116 1118
1117;;;###mh-autoload 1119;;;###mh-autoload
1118(defun mh-mairix-execute-search (folder-path search-regexp-list) 1120(defun mh-mairix-execute-search (folder-path search-regexp-list)
1119 "Execute mairix and read the results. 1121 "Execute mairix.
1120 1122
1121In the examples below, replace \"/home/user/Mail\" with the path 1123In the examples below, replace \"/home/user/Mail\" with the path
1122to your MH directory. 1124to your MH directory.
@@ -1250,7 +1252,7 @@ REGEXP-LIST is an alist of fields and values."
1250 1252
1251;;;###mh-autoload 1253;;;###mh-autoload
1252(defun mh-namazu-execute-search (folder-path search-regexp) 1254(defun mh-namazu-execute-search (folder-path search-regexp)
1253 "Execute namazu and read the results. 1255 "Execute namazu.
1254 1256
1255In the examples below, replace \"/home/user/Mail\" with the path to 1257In the examples below, replace \"/home/user/Mail\" with the path to
1256your MH directory. 1258your MH directory.
@@ -1328,9 +1330,9 @@ is used to search."
1328(defun mh-pick-execute-search (folder-path search-regexp) 1330(defun mh-pick-execute-search (folder-path search-regexp)
1329 "Execute pick. 1331 "Execute pick.
1330 1332
1331There are no semantics associated with the search criteria--they 1333Read \"pick(1)\" or the section Finding Messages with pick in the
1332are simply treated as strings. Case is ignored when all lowercase 1334MH book to find out more about how to enter the criteria (see URL
1333is used, and regular expressions (a la \"ed\") are available. 1335`http://www.ics.uci.edu/~mh/book/mh/finpic.htm').
1334 1336
1335In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP 1337In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP
1336is used to search." 1338is used to search."
@@ -1414,7 +1416,12 @@ COMPONENT is the component to search."
1414 1416
1415;;;###mh-autoload 1417;;;###mh-autoload
1416(defun mh-grep-execute-search (folder-path search-regexp) 1418(defun mh-grep-execute-search (folder-path search-regexp)
1417 "Execute grep and read the results. 1419 "Execute grep.
1420
1421Unlike the other search methods, this method does not use the
1422MH-Search buffer. Instead, you simply enter a regular expression
1423in the minibuffer. For help in constructing regular expressions,
1424see your man page for \"grep\".
1418 1425
1419In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP 1426In a program, FOLDER-PATH is the directory in which SEARCH-REGEXP
1420is used to search." 1427is used to search."
@@ -1477,6 +1484,7 @@ construct the base name."
1477 (insert "_" s))) 1484 (insert "_" s)))
1478 (setq string (mh-replace-string "-lbrace" " ")) 1485 (setq string (mh-replace-string "-lbrace" " "))
1479 (setq string (mh-replace-string "-rbrace" " ")) 1486 (setq string (mh-replace-string "-rbrace" " "))
1487 (setq string (mh-replace-string "-search" " "))
1480 (subst-char-in-region (point-min) (point-max) ?( ? t) 1488 (subst-char-in-region (point-min) (point-max) ?( ? t)
1481 (subst-char-in-region (point-min) (point-max) ?) ? t) 1489 (subst-char-in-region (point-min) (point-max) ?) ? t)
1482 (subst-char-in-region (point-min) (point-max) ?- ? t) 1490 (subst-char-in-region (point-min) (point-max) ?- ? t)
@@ -1492,7 +1500,7 @@ construct the base name."
1492 (subst-char-in-region (point-min) (point-max) ?\r ?_ t) 1500 (subst-char-in-region (point-min) (point-max) ?\r ?_ t)
1493 (subst-char-in-region (point-min) (point-max) ?/ ?$ t) 1501 (subst-char-in-region (point-min) (point-max) ?/ ?$ t)
1494 (let ((out (truncate-string-to-width (buffer-string) 20))) 1502 (let ((out (truncate-string-to-width (buffer-string) 20)))
1495 (cond ((eq mh-indexer 'flists) 1503 (cond ((eq mh-searcher 'flists)
1496 (format "%s/%s" mh-flists-results-folder mh-flists-sequence)) 1504 (format "%s/%s" mh-flists-results-folder mh-flists-sequence))
1497 ((equal out mh-flists-results-folder) (concat out "1")) 1505 ((equal out mh-flists-results-folder) (concat out "1"))
1498 (t out))))) 1506 (t out)))))