annotate lisp/mh-e/mh-pick.el @ 62993:67de0f04e17e

*** empty log message ***
author Richard M. Stallman <rms@gnu.org>
date Sat, 04 Jun 2005 10:24:11 +0000
parents aa8c2e12ee24
children 18a818a2ee7c 01137c1fdbe9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
1 ;;; mh-pick.el --- make a search pattern and search for a message in MH-E
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
2
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
3 ;; Copyright (C) 1993, 1995,
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
4 ;; 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
5
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
6 ;; Author: Bill Wohler <wohler@newt.com>
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
7 ;; Maintainer: Bill Wohler <wohler@newt.com>
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
8 ;; Keywords: mail
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
9 ;; See: mh-e.el
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
10
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
12
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
13 ;; GNU Emacs is free software; you can redistribute it and/or modify
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
15 ;; the Free Software Foundation; either version 2, or (at your option)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
16 ;; any later version.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
17
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
21 ;; GNU General Public License for more details.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
22
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
26 ;; Boston, MA 02111-1307, USA.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
27
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
28 ;;; Commentary:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
29
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
30 ;; Internal support for MH-E package.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
31
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
32 ;;; Change Log:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
33
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
34 ;;; Code:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
35
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
36 (eval-when-compile (require 'mh-acros))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
37 (mh-require-cl)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
38 (require 'mh-e)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
39 (require 'easymenu)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
40 (require 'gnus-util)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
41
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
42 ;;; Internal variables:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
43
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
44 (defvar mh-pick-mode-map (make-sparse-keymap)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
45 "Keymap for searching folder.")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
46
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
47 (defvar mh-searching-folder nil) ;Folder this pick is searching.
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
48 (defvar mh-searching-function nil)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
49
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
50 (defconst mh-pick-single-dash '(cc date from subject to)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
51 "Search components that are supported by single-dash option in pick.")
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
52
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
53 ;;;###mh-autoload
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
54 (defun mh-search-folder (folder window-config)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
55 "Search FOLDER for messages matching a pattern.
62847
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
56
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
57 With this command, you can search a folder for messages to or from a
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
58 particular person or about a particular subject. In fact, you can also search
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
59 for messages containing selected strings in any arbitrary header field or any
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
60 string found within the messages.
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
61
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
62 You are first prompted for the name of the folder to search and then placed in
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
63 the following buffer in MH-Pick mode:
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
64
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
65 From:
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
66 To:
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
67 Cc:
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
68 Date:
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
69 Subject:
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
70 --------
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
71
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
72 Edit this template by entering your search criteria in an appropriate header
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
73 field that is already there, or create a new field yourself. If the string
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
74 you're looking for could be anywhere in a message, then place the string
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
75 underneath the row of dashes. The \\[mh-search-folder] command uses the MH
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
76 command \"pick\" to do the real work.
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
77
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
78 There are no semantics associated with the search criteria--they are simply
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
79 treated as strings. Case is ignored when all lowercase is used, and regular
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
80 expressions (a la \"ed\") are available. It is all right to specify several
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
81 search criteria. What happens then is that a logical _and_ of the various
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
82 fields is performed. If you prefer a logical _or_ operation, run
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
83 \\[mh-search-folder] multiple times.
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
84
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
85 As an example, let's say that we want to find messages from Ginnean about
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
86 horseback riding in the Kosciusko National Park (Australia) during January,
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
87 1994. Normally we would start with a broad search and narrow it down if
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
88 necessary to produce a manageable amount of data, but we'll cut to the chase
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
89 and create a fairly restrictive set of criteria as follows:
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
90
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
91 From: ginnean
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
92 To:
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
93 Cc:
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
94 Date: Jan 1994
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
95 Subject: horse.*kosciusko
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
96 --------
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
97
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
98 As with MH-Letter mode, MH-Pick provides commands like
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
99 \\<mh-pick-mode-map>\\[mh-to-field] to help you fill in the blanks.
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
100
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
101 To perform the search, type \\[mh-do-search]. The selected messages are placed
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
102 in the \"search\" sequence, which you can use later in forwarding, printing,
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
103 or narrowing your field of view. Subsequent searches are appended to the
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
104 \"search\" sequence. If, however, you wish to start with a clean slate, first
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
105 delete the \"search\" sequence.
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
106
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
107 If you're searching in a folder that is already displayed in an MH-Folder
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
108 buffer, only those messages contained in the buffer are used for the search.
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
109 Therefore, if you want to search in all messages, first kill the folder's
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
110 buffer with \\<mh-folder-mode-map>\\[kill-buffer] or scan the entire folder
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
111 with \\[mh-rescan-folder].
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
112
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
113 If you find that you do the same thing over and over when editing the search
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
114 template, you may wish to bind some shortcuts to keys. This can be done with
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
115 the variable `mh-pick-mode-hook', which is called when \\[mh-search-folder] is
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
116 run on a new pattern.
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
117
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
118 If you have run the \\[mh-index-search] command, but change your mind while
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
119 entering the search criteria and actually want to run a regular search, then
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
120 you can use the \\<mh-pick-mode-map>\\[mh-pick-do-search] command.
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
121
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
122 In a program, argument WINDOW-CONFIG is the current window configuration and
aa8c2e12ee24 Upgraded to MH-E version 7.84.
Bill Wohler <wohler@newt.com>
parents: 62766
diff changeset
123 is used when the search folder is dismissed."
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
124 (interactive (list (mh-prompt-for-folder "Search" mh-current-folder nil nil t)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
125 (current-window-configuration)))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
126 (let ((pick-folder (if (equal folder "+") mh-current-folder folder)))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
127 (switch-to-buffer-other-window "search-pattern")
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
128 (if (or (zerop (buffer-size))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
129 (not (y-or-n-p "Reuse pattern? ")))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
130 (mh-make-pick-template)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
131 (message ""))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
132 (setq mh-searching-function 'mh-pick-do-search
50702
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
133 mh-searching-folder pick-folder)
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
134 (mh-make-local-vars 'mh-current-folder folder
7dd3d5eae9c7 Upgraded to MH-E version 7.3.
Bill Wohler <wohler@newt.com>
parents: 49578
diff changeset
135 'mh-previous-window-config window-config)
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
136 (message "%s" (substitute-command-keys
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
137 (concat "Type \\[mh-do-search] to search messages, "
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
138 "\\[mh-help] for help.")))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
139
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
140 (defun mh-make-pick-template ()
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
141 "Initialize the current buffer with a template for a pick pattern."
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
142 (let ((inhibit-read-only t)) (erase-buffer))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
143 (insert "From: \n"
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
144 "To: \n"
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
145 "Cc: \n"
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
146 "Date: \n"
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
147 "Subject: \n"
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
148 "---------\n")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
149 (mh-pick-mode)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
150 (goto-char (point-min))
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
151 (dotimes (i 5)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
152 (add-text-properties (point) (1+ (point)) '(front-sticky t))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
153 (add-text-properties (- (line-end-position) 2) (1- (line-end-position))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
154 '(rear-nonsticky t))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
155 (add-text-properties (point) (1- (line-end-position)) '(read-only t))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
156 (forward-line))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
157 (add-text-properties (point) (1+ (point)) '(front-sticky t))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
158 (add-text-properties (point) (1- (line-end-position)) '(read-only t))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
159 (goto-char (point-max)))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
160
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
161 ;;; Menu extracted from mh-menubar.el V1.1 (31 July 2001)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
162 (easy-menu-define
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
163 mh-pick-menu mh-pick-mode-map "Menu for MH-E pick-mode"
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
164 '("Pick"
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
165 ["Execute the Search" mh-pick-do-search t]))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
166
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
167
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
168 ;;; Help Messages
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
169 ;;; Group messages logically, more or less.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
170 (defvar mh-pick-mode-help-messages
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
171 '((nil
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
172 "Search messages using pick: \\[mh-pick-do-search]\n"
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
173 "Search messages using index: \\[mh-index-do-search]\n"
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
174 "Move to a field by typing C-c C-f C-<field>\n"
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
175 "where <field> is the first letter of the desired field."))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
176 "Key binding cheat sheet.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
177
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
178 This is an associative array which is used to show the most common commands.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
179 The key is a prefix char. The value is one or more strings which are
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
180 concatenated together and displayed in the minibuffer if ? is pressed after
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
181 the prefix character. The special key nil is used to display the
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
182 non-prefixed commands.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
183
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
184 The substitutions described in `substitute-command-keys' are performed as
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
185 well.")
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
186
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
187 (put 'mh-pick-mode 'mode-class 'special)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
188
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
189 (define-derived-mode mh-pick-mode fundamental-mode "MH-Pick"
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
190 "Mode for creating search templates in MH-E.\\<mh-pick-mode-map>
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
191
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
192 After each field name, enter the pattern to search for. If a field's
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
193 value does not matter for the search, leave it empty. To search the
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
194 entire message, supply the pattern in the \"body\" of the template.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
195 Each non-empty field must be matched for a message to be selected.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
196 To effect a logical \"or\", use \\[mh-search-folder] multiple times.
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
197 When you have finished, type \\[mh-pick-do-search] to do the search.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
198
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
199 The value of `mh-pick-mode-hook' is a list of functions to be called,
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
200 with no arguments, upon entry to this mode.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
201
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
202 \\{mh-pick-mode-map}"
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
203
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
204 (make-local-variable 'mh-searching-folder)
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
205 (make-local-variable 'mh-searching-function)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
206 (make-local-variable 'mh-help-messages)
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
207 (easy-menu-add mh-pick-menu)
62766
3c93535b9c17 (mh-pick-mode): Remove spurious run-hooks.
Lute Kamstra <lute@gnu.org>
parents: 62465
diff changeset
208 (setq mh-help-messages mh-pick-mode-help-messages))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
209
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
210 ;;;###mh-autoload
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
211 (defun mh-pick-do-search ()
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
212 "Find messages that match the qualifications in the current pattern buffer.
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
213 Messages are searched for in the folder named in `mh-searching-folder'.
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
214 Add the messages found to the sequence named `search'."
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
215 (interactive)
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
216 (let ((pattern-list (mh-pick-parse-search-buffer))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
217 (folder mh-searching-folder)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
218 (new-buffer-flag nil)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
219 (window-config mh-previous-window-config)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
220 range pick-args msgs)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
221 (unless pattern-list
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
222 (error "No search pattern specified"))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
223 (save-excursion
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
224 (cond ((get-buffer folder)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
225 (set-buffer folder)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
226 (setq range (if (and mh-first-msg-num mh-last-msg-num)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
227 (format "%d-%d" mh-first-msg-num mh-last-msg-num)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
228 "all")))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
229 (t
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
230 (mh-make-folder folder)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
231 (setq range "all")
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
232 (setq new-buffer-flag t))))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
233 (setq pick-args (mh-pick-regexp-builder pattern-list))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
234 (when pick-args
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
235 (setq msgs (mh-seq-from-command folder 'search
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
236 `("pick" ,folder ,range ,@pick-args))))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
237 (message "Searching...done")
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
238 (if (not new-buffer-flag)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
239 (switch-to-buffer folder)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
240 (mh-scan-folder folder msgs)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
241 (setq mh-previous-window-config window-config))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
242 (mh-add-msgs-to-seq msgs 'search)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
243 (delete-other-windows)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
244
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
245 ;;;###mh-autoload
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
246 (defun mh-do-search ()
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
247 "Use the default searching function.
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
248 If \\[mh-search-folder] was used to create the search pattern then pick is used
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
249 to search the folder. Otherwise if \\[mh-index-search] was used then the
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
250 indexing program specified in `mh-index-program' is used."
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
251 (interactive)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
252 (if (symbolp mh-searching-function)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
253 (funcall mh-searching-function)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
254 (error "No searching function defined")))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
255
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
256 (defun mh-seq-from-command (folder seq command)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
257 "In FOLDER, make a sequence named SEQ by executing COMMAND.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
258 COMMAND is a list. The first element is a program name
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
259 and the subsequent elements are its arguments, all strings."
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
260 (let ((msg)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
261 (msgs ())
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
262 (case-fold-search t))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
263 (save-excursion
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
264 (save-window-excursion
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
265 (if (eq 0 (apply 'mh-exec-cmd-quiet nil command))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
266 ;; "pick" outputs one number per line
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
267 (while (setq msg (car (mh-read-msg-list)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
268 (setq msgs (cons msg msgs))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
269 (forward-line 1))))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
270 (set-buffer folder)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
271 (setq msgs (nreverse msgs)) ;put in ascending order
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
272 msgs)))
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
273
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
274 (defun mh-pick-parse-search-buffer ()
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
275 "Parse the search buffer contents.
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
276 The function returns a alist. The car of each element is either the header name
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
277 to search in or nil to search the whole message. The cdr of the element is the
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
278 pattern to search."
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
279 (save-excursion
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
280 (let ((pattern-list ())
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
281 (in-body-flag nil)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
282 start begin)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
283 (goto-char (point-min))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
284 (while (not (eobp))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
285 (if (search-forward "--------" (line-end-position) t)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
286 (setq in-body-flag t)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
287 (beginning-of-line)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
288 (setq begin (point))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
289 (setq start (if in-body-flag
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
290 (point)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
291 (search-forward ":" (line-end-position) t)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
292 (point)))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
293 (push (cons (and (not in-body-flag)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
294 (intern (downcase
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
295 (buffer-substring-no-properties
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
296 begin (1- start)))))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
297 (mh-index-parse-search-regexp
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
298 (buffer-substring-no-properties
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
299 start (line-end-position))))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
300 pattern-list))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
301 (forward-line))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
302 pattern-list)))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
303
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
304
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
305
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
306 ;; Functions specific to how pick works...
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
307 (defun mh-pick-construct-regexp (expr component)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
308 "Construct pick compatible expression corresponding to EXPR.
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
309 COMPONENT is the component to search."
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
310 (cond ((atom expr) (list component expr))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
311 ((eq (car expr) 'and)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
312 `("-lbrace" ,@(mh-pick-construct-regexp (cadr expr) component) "-and"
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
313 ,@(mh-pick-construct-regexp (caddr expr) component) "-rbrace"))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
314 ((eq (car expr) 'or)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
315 `("-lbrace" ,@(mh-pick-construct-regexp (cadr expr) component) "-or"
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
316 ,@(mh-pick-construct-regexp (caddr expr) component) "-rbrace"))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
317 ((eq (car expr) 'not)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
318 `("-lbrace" "-not" ,@(mh-pick-construct-regexp (cadr expr) component)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
319 "-rbrace"))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
320 (t (error "Unknown operator '%s' seen" (car expr)))))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
321
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
322 ;; All implementations of pick have special options -cc, -date, -from and
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
323 ;; -subject that allow to search for corresponding components. Any other
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
324 ;; component is searched using option --COMPNAME, for example: `pick
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
325 ;; --x-mailer mh-e'. Mailutils `pick' supports this option using a certain
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
326 ;; kludge, but it prefers the following syntax for this purpose:
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
327 ;; `--component=COMPNAME --pattern=PATTERN'.
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
328 ;; -- Sergey Poznyakoff, Aug 2003
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
329 (defun mh-pick-regexp-builder (pattern-list)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
330 "Generate pick search expression from PATTERN-LIST."
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
331 (let ((result ()))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
332 (dolist (pattern pattern-list)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
333 (when (cdr pattern)
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
334 (setq result `(,@result "-and" "-lbrace"
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
335 ,@(mh-pick-construct-regexp
56673
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
336 (if (and (mh-variant-p 'mu-mh) (car pattern))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
337 (format "--pattern=%s" (cdr pattern))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
338 (cdr pattern))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
339 (if (car pattern)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
340 (cond
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
341 ((mh-variant-p 'mu-mh)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
342 (format "--component=%s" (car pattern)))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
343 ((member (car pattern) mh-pick-single-dash)
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
344 (format "-%s" (car pattern)))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
345 (t
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
346 (format "--%s" (car pattern))))
e9a6cbc8ca5e Upgraded to MH-E version 7.4.80.
Bill Wohler <wohler@newt.com>
parents: 52401
diff changeset
347 "-search"))
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
348 "-rbrace"))))
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
349 (cdr result)))
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
350
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
351
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
352
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
353 ;;; Build the pick-mode keymap:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
354 ;;; If this changes, modify mh-pick-mode-help-messages accordingly, above.
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
355 (gnus-define-keys mh-pick-mode-map
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
356 "\C-c?" mh-help
49578
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
357 "\C-c\C-i" mh-index-do-search
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
358 "\C-c\C-p" mh-pick-do-search
b35587af8747 Upgraded to MH-E version 7.2.
Bill Wohler <wohler@newt.com>
parents: 49459
diff changeset
359 "\C-c\C-c" mh-do-search
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
360 "\C-c\C-f\C-b" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
361 "\C-c\C-f\C-c" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
362 "\C-c\C-f\C-d" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
363 "\C-c\C-f\C-f" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
364 "\C-c\C-f\C-r" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
365 "\C-c\C-f\C-s" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
366 "\C-c\C-f\C-t" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
367 "\C-c\C-fb" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
368 "\C-c\C-fc" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
369 "\C-c\C-fd" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
370 "\C-c\C-ff" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
371 "\C-c\C-fr" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
372 "\C-c\C-fs" mh-to-field
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
373 "\C-c\C-ft" mh-to-field)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
374
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
375 (provide 'mh-pick)
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
376
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
377 ;;; Local Variables:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
378 ;;; indent-tabs-mode: nil
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
379 ;;; sentence-end-double-space: nil
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
380 ;;; End:
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
381
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 50702
diff changeset
382 ;;; arch-tag: aef2b271-7768-42bd-a782-9a14ba9f83f7
49459
06b77df47802 * mh-e: Created directory. ChangeLog will appear in a week when we
Bill Wohler <wohler@newt.com>
parents:
diff changeset
383 ;;; mh-pick.el ends here